You CAN seal magma with water (turning magma into obsidian), but it's a lot of work.
To seal the way to anything (magma, water, caves, upper exterior environment, etc), you typically use raising drawbridges (for magma, all the material in the bridge has to be magma safe, i.e. all stones/metal/wood it's made of, as well as the mechanism(s) inside it use to control it).
To get at the magma, dig a suitable tunnel up to, but not into the magma source (i.e. one tile left). Then build a bridge to control the access to the magma once the source is breached (I usually use two bridges spaced to get an airlock type structure, but that's not necessary). Once the bridges are set up (and tested: it's far too easy to accidentally create a retracting bridge rather than a raising one!), breach the magma source. That can be done in two ways:
either have a miner just dig out the last tile, which carries the risk of the dwarf being ignited by magma, or have the miner channel the last tile from above. Note that after having channelled from above, you have access from the magma sea to that tunnel as well, so you want to draw bridge protect that access too.
If you use the first method, you should make as sure as you can that the miner immediately leaves the area, e.g. having another mining job elsewhere (and make sure no other miner hogs it, so digging out a strip rather than a 1 tile corridor is safer). You can cancel the job once the miner is clear (i.e. inside your sealing bridge, and, if any magma passed the bridge before it was raised, then out of the tunnel reserved for the magma). There is no guarantee though. Your miner might decide that after all that sweaty work close to the hot magma, it's time for a drink, cleaning, or just a quiet lie down. I would advice against trying to use burrows for this purpose, though, since dwarves seem to be very sluggish when it comes to responding to burrows (I think I've read somewhere that a burrow overhaul is next on Toady One's agenda).
Think of magma as extra dangerous water. The magma sea has a rock roof above it (if the sea is at varying depth, the roof is as well, leaving no gap), so to get at it from above you need to channel down to the magma layer.