You could also do this: Divert the brook somehow to something that will drain it by means of holes in the floor. You can do this by mining under the brook then dropping a cavein onto the weak spots (where there's empty space under the brook). Have the water divert to an appropriate container, such as a quarry or other place where you have the spare room. You can install crusher drawbridges down there to ensure that the water never fills, if you must.
You now have a waterfall going down into subterranean areas. This is desirable, for this is Step One, and the brook will go into the hole. Hopefully your hole covers the entire width of the brook, so you have a nice one-tile-wide strip of open space that goes from one side to the other.
You can now, while the brook drains into the bowels of whatever you're draining it into, send dwarves in (quickly, now, before it fills up whatever you are draining it into!) and have them build constructed walls over the holes. Because there is floor next to it, the holes can be built over (considered to have support) but because there is no floor THERE, the dwarves will have no trouble with going in on the dry side and building walls there.
I came up with this one day when I accidentally dug a small channel that opened the fort to the brook. The easiest way to plug such a hole is to dig a channel that drains someplace, so it won't fill, and build a wall over the channel, so that you get no problems with water being in the tile (since, there being a hole there, there won't be).
Becomes
~~~~
~~~~
. . . .
* * * * (mud)
Becomes
~~~~
~~~~
O - - O
(the rest of the brook is now dry, having been successfully dammed)
Easy-peasy, and it requires no magma and works with constructed walls (since, even though they deconstruct on cavein, they can, as anyone who has built a megaproject over their fort and had to make small adjustments knows, still punch through floors as long as there's no wall underneath). The walls even stop the brook from draining any further once you have them in, since they plug it up completely! Handy, that.