My sollution for imps has always been this (no problems yet):
1) After digging out the room, dig a shrot hallway ending in a stairway down in the direction of the magma vent.
2) dig a tunnel under the room ending at the magma source, and a stairway up (and tunnel if necessary) to the magma chamber.
3) Put a door on that short hallway.
4) have a dwarf channel the last square at teh magma source, releasing the magma into the tunnel.
5) Lock the door to the short hallway and wall it in... this seals off that hall from everything forever.
6) Now that you have the magma extended safely under the floors of the room, all you need to do to place a magma forge or smelter is to channel a square where you want it placed and then build the building placing one of it's impassible squares (dark green) over the hole in the floor.
When the forge is built the impassible square seals off that square in the process so imps and magma men still have no way of exiting the magma.
SO, here is what it looks like:
~~~~~X~~~~~
Where ~ is the tunnel underground and X is the channel in the room inself.
Then you build the building like this....
~~~~O#O~~~~
OOO
OOO
Where # is the impassable square. Or...
OOO
~~~~~#O#~~~
OOO
I can't remember what the glass workshop looks like, but the same principle applies.
When done this way you really don't need bauxite to protect your foundry room.... though an extra layer of protection never hurts.