Measure the distance between the outside edges of the studs for vertical pipes along walls or joists for horizontal pipes along the ceiling on both sides of the pipe. Cut several lengths of 2-by-4-feet lumber in accordance with your measurements.
Cut several pieces of 2-by-4-feet lumber approximately 6 inches longer than the distance from the wall to the outer edge of the pipe; make the pieces longer or shorter if you want more or less space around the pipe. Nail these pieces across from each other at 24 inch intervals alongside the pipe so that they extend beyond the pipe and into the room.
Insert the lengths you cut earlier between the extending pieces and nail them into place. You now have a box around the pipe.
Cut wallboard to fit around the box and nail it in place. Attach corner bead along the outside corners of the box.
Apply a thin coat of joint compound along the wallboard seams using your wallboard knife. Press a strip of wallboard tape into the compound along the seams. Apply a second coat of compound, and let the mud dry overnight. Apply an additional coat of compound, let it dry, then sand with medium-grit sandpaper to smooth.