Answer
One can view spectra of other stars, or, use a space-based observing platform.
Work Step by Step
By observing the spectra of other stars (not the same type of star as our sun) through Earth’s atmosphere, and comparing them to solar observations also made through earth's atmosphere, we deduce that the lines in common are those due to Earth’s atmosphere. Then, when viewing solar spectra, we can distinguish the absorption lines that are due solely to the atmosphere of Sol, our sun.
We could also use an orbiting telescope, located above Earth's atmosphere.