When light enters your telescope, light from all sources visible in the field of view is present in all parts of your lens or your mirror. But what the optics does is that it sorts light based on angle of incidence, such that all light from one particular angle also is projected in a particular angle. That is why you can see an image there, and not just a gray smeared mix of light waves. On the focal plane - in the image - the light is already sorted for you: When you see an image of a star, it is because all the light from that particular star has been directed to one point on your image plane.
From there, it is a matter of simply isolating light from different areas of the image plane. You do not lose any light from that object, because all light from the object is where you want it already (this is only an idealized approximation, in real life you do lose a bit because of diffraction and atmospheric blurring etc, but it's close enough).
There are several different ways of doing this. The classic method is to cover the majority of the image plane (where you would normally have the photographic paper or your CCD) with a screen with a small aperture or slit, blocking out all other light than that of the object of interest. This light can then, with additional optics, be redirected into your dispersion unit (prism, grating, or grism).
One variation of this method which is particularly popular with stars in crowded star fields, is to use movable optical fibers. This has the advantage that you can extract light from a lot of stars at the same time, avoiding loss of information and still keep the quality of each spectrum as high as you would have with just a single aperture.
For extended sources like e.g. nearby galaxies, Integral Field Units are very popular (but expensive!). There, you slice the entire image up in pixels with e.g. a big array of tiny lenses, and direct the light from each pixel into its own separate dispersion unit. This is not a good idea for star fields, where the images of individual stars may overlap 4 or more pixels, but for large nebulae of gas, it is extremely useful.
Finally, there is also the primitive but cheap and efficient slitless spectroscopy. In this, you just place a dispersion unit directly at the image plane of your telescope, and let all the objects there draw out into wide stripes, each a 2D spectrum. The downside to this is that spectra may often overlap. The advantage is that it is cheap and simple, and because of the simplicity, you lose much less light in the optics, so you can see faint objects with relatively short exposure times.
EDIT: I just found this picture on Neill Reid's homepage at STScI and thought I'd add it here. It's what slitless spectroscopy looks like. The ring is the remnant of Supernova 1987A; blue is a normal image of the field around it, orange is the slitless spectrum. The multiple images of the NS remnant represent various emission lines; there is almost no emission from the ring in other wavelengths.