There's two different patterns to the magma workshops. The Forge has (IIRC) left-middle and right-middle squares as "building tiles", impassible along both Z and intra-Z movement, the others (kiln, glass furnace, smelter) have the top-central square likewise.
If you make your obligatory "channel over the magma" square equivalent to these squares (the top-central one for most of them, one and/or the other side-tiles in the case of the forge) and no others, the building itself should be sufficient to block ingress of anything that would otherwise bother you.
I double this up with specifically-channelled magmaducts driven in the layer below the workshop area to supply the workshops on the level above and access the magma pipe (or, occasionally, magma sea itself) from the side, with a diagonal connection to the magma-source dug (actually, fortification-linked, by a stone-smoother). Once I've set up a floodgate. When the floodgate has been opened, the fortification link made and the magma channel is finally full (with no pesky 6/7ths running around it), I close the floodgate and have no cares in the world about any further incursions. Nor of accidentally depleting my magma-source and deactivating the workshops relying on the magma, because they still have their duct's-worth of it keeping them powered.
But there are other ways of doing it.