It helps to visualize how DF sees tiles and zlayers.
Basically, a tile looks like this:
-
X
-
The top dash is the membrane between the layer with the X and the layer above it. If that layer does not exist, then things like dwarves and water and what have you can move through it. Building ramps, staircases, or channeling it from above removes that membrane.
The X is the layer in question. You can clear it by channeling out the space, or just digging it out from the side. The game wants that X to be clear when you build constructions or buildings on it, such as floors, staircases, walls, workshops, beds, or whatever.
The bottom dash is the membrane between the layer with the X and the layer below it. It works much like the upper membrane, except that when you channel through it it will also remove the top membrane of the layer below. The reverse is not true. If you build a lot of up/down staircases, you will notice that at the bottom you can see what kind of stone is there, but the opposite is not true for the top. This is why.
Now, in your example, you want to build a wall in a space where the X and bottom layer have been removed. The kicker here is, when you are building a construction the game only checks to see whether the X is cleared and whether the tile is accessible from the side. It does NOT check whether there is a floor there. Building a wall there automatically closes the bottom and top membrane. Similarly, the reason you could not construct a floor and then construct a wall on top of it is because the floor is already taking up that X space, so far as constructions are concerned. If you just wanted to close the bottom membrane without building a construction on that tile (say, if you wanted to fill in a murky pool so you could build a paved road over it) then you could ramp down to that lower level and build a wall there. The wall on the lower level will close the the bottom membrane on the upper level, without using up the X space for constructions.