I am looking to add a small closet (2×4 ft) in the corner of a room with lath and plaster walls. I would like to frame in two sides and attach it to the existing wall. Do I have to limit myself to the existing stud locations to anchor the new walls or is there a way to add another stud without destroying the existing wall?
To answer the original question, the studs at either end of the closet will not need to define the dimensions. The stud at either can be screwed in place. Do not use nails. The vibration from setting the nail will break off the keys of plaster that hold the plaster up on the wall. Use enough screws to increase the chances of finding the wood lath to secure the last stud in the wall. The top and bottom plates as mentioned in other answers will do the rest.
To address another valid issue that was brought up about direction the walls over the joists. If the long wall is across the joists, and portions of the wall that are supported by these joists will be fine. Actually, the wall should be so light in weight there will be, or should be, little or no concern. If the side the door is hinged happens to sit on or near a joist, the better the support for the wall. Half the weight on the shelves will be supported by one of the existing walls the other at the back existing wall and a bit on the new wall. If the floor that the closet is built on has subfloor, all the better.
The problem that is encountered is when you are installing the partition top plate at the ceiling. If the location of the wall doesn't line up plumb with a joist you will need to install bridging across the ceiling joists first at 16 inch intervals. The bridging will allow you to secure the top plate between two joists so the closet wall can be located according to your preferences and not by the buildings framing. You will have to open portions of the ceiling to install the 2 x 4 inch blocks between joists. They should be flush with the ceiling surface when completed. 3 inch screws will hold better than nails and allow for any adjustments if needed.
If the new wall's top and bottom plates are nailed into ceiling and floor joists, it's self-supporting and does not need a structural connection to the wall it butts up against.