Your local building codes would, of course, depend on your location.
It it's OK most places to build partition walls that are not full height. It's done in offices to create cubicle-like spaces, it's done in homes to give some separation between rooms, etc.
If you consider the wall to be part of the structure, I'd bet in most places it's not building code compliant to attach only at the walls, not at the floor.
If you consider the wall something like a cubicle partition, more of a piece of furniture rather than a part of the structure, those are often attached only at the wall and not at the floor. Of course you have to follow the manufacturer's instructions for the system to get something that won't fall down.
Common sense - in normal wall construction the last stud isn't attached to the rest of the wall with much strength. Without attachments to the ceiling and / or floor, all that's holding it together is a few nails into the header and sole, and the drywall. It would be big enough to do damage or hurt somebody if it fell over. I wouldn't do it.