Here's the way I do it:

Fill a layer with the desired texture. Do whatever you need to make the texture fit the entire image—I usually make several copies, sliding them around to fill the canvas and making sure they overlap quite a bit, then I use a very soft eraser to blend the edges to make it look relatively seamless. With more work, you can make it actually seamless, but I don't usually find it worth the effort. Then I select all of the texture layers and merge them (Ctrl-E) into a single layer.

Once you have your texture layer, add a black layer mask to it. (Layer > Layer Mask > Hide All). Your texture will vanish, and a black rectangle will appear in the Layers palette. This is the mask you just made. Click on it to select it, then activate the Rectangular Marquee tool (M). In the toolbar, there are four icons that look like rectangles intersecting in dfferent ways. From left to right, they are: New Selection, Add to Selection, Subtract from Selection, and Intersect with Selection. Use this tool in those various modes to create a selection that is in the shape of the walls you want to build. For this purpose, I'd probably start with a large box the size of the room, then change to Subtract mode and make a smaller box inside that one. That will cut out an unselected area in the middle of the larger box, giving you a hollow rectangle. Then subtract some spaces for the doors, and if you want some internal walls or pillars, you can switch back to Add mode and put those in the selection. Once you're satisfied with the shape, make sure your foreground color is set to white, and use the Paint Bucket to fill the selected areas with white.

Since you've done this on a layer mask, the texture will reappear in the areas you had selected.

You can make adjustments to the layer mask after the fact to change the shape, round off the corners, feather the edges, or add and subtract new areas. You can also paint on the mask with the Brush tool. If you use shades of gray, the texture will become translucent. And if you make all of your layers like this, you can easily use the document as a template for all of your tiles, so that they have a consistent look with very little effort.

Effects applied to the layer such as Outer Glow, which is a popular way to get that ambient occlusion shadow for walls, will be applied based on the edge of the mask.

If you want more information on this technique, do a search for the term non-destructive, and maybe dungeons. I think there are a couple of tutorials out there that describe the process better, and with pictures to illustrate it.