That would hypothetically work, but you're looking at a whole host of engineering problems. I'll do my best to list some of them:
1) The force on the supports would be immense. There's a reason we build our buildings like this:
(C = container for the building)
C
-
|
|
|
-
Instead of this
|---C---|
| |
- -
A horizontal beam provides zero support to a vertical thing it is attached to (other than it's own intrinsic ability to resist bending, which is factors of magnitude lower than it's ability to resist compression). You could compensate somewhat by using something like carbon nanotube ropes to hold it up, but even then it would look more like this:
|-_ _-|
| -C- |
- -
2) Your building flipping over. Most of our buildings are guaranteed to not flip over randomly, so the center of gravity can be pretty far up on the building. A floating building doesn't really have near as much of a guarantee, so you'd need to address the problem. Probably the best way to do that is just to have a freely rotating shell that your actual building was in, so that the building was always guaranteed to remain upright.
3) The strength of a magnet you would need. While this isn't a problem in the "house" range, once you start to get into the "skyscraper" type of range you end up with a field that is strong enough that anyone moving through the field would experience nausea and disorientation. This wouldn't be a problem inside of the shell around your floating building, but anyone moving to/from the building would be in for a bad time. It would also be strong enough (even in the house range) to start messing with things like pacemakers and pull slightly on anything ferromagnetic (iron/steel for the most part).
4) Assuming you used a shell to stop your building from flipping, you run into all sorts of problems with getting through the shell. Doable, but a pain in the ass for the designing engineers.
5) Getting up/down from your floating building.
5) Horizontal forces. Without anything to tether it in place, even simple things like stepping from whatever method you use to get up to it into your floating building would exert a horizontal force that would cause it to start drifting over time. Anything like a tiny wind would make it go flying like an ice skater. It's very likely your floating building would end up drifting to rest up against the side of the container pretty quickly without constant corrections.
So yes, it's possible, but you're looking so far outside of the realm of plausible that you aren't going to see it happening. For the amount of problems it would cause you'd be better off just building a normal skyscraper up to whatever height you were originally going to suspend your floating building inside a shell inside a container at, and then building whatever building you wanted to float on the top. It would cost less, be more feasible to build, and would have greater floor space by the factor of a couple of magnitudes.