A really good option for sheetrock or plaster walls would be to buy an "Old Work" single gang box. These are available at most hardware and building material supply stores. Make sure the circuit is dead and cut a rectangular hole the size of the box. Make sure you don't cut it too large because the outer lip of the box will need to be flush with your wall. Insert the wiring into the holes on the back of the box. These boxes will work without the need for nailing it to a stud. When you turn the screws at the top and bottom, a small flapper will tighten the box to the backside of the existing sheetrock/plaster wall. Once tightened you should cap off each wire with a wire nut and tuck them inside the box.
For concrete or brick walls you might choose a "Low Profile" gang box (1-1/4" thick). This can be attached with a construction adhesive or some Tapcon masonry screws. This application won't be flush, but it will leave plenty of room for furniture and appliances to be placed against the wall.
Either way, I would suggest buying a blank wall plate to cover the box and wiring. If you ever need the wiring in the future, you already have a box and the wiring is easily accessed.