When you pass sunlight through a prism or diffraction grating you get a spectrum with dark absorption lines at very specific frequencies, and these lines are the fingerprints of specific elements in specific ionization states. The pattern of these lines tells us not just what elements are present but crucially what state those elements are in, and the solar spectrum shows us unmistakably that hydrogen and helium on the sun are highly ionized, meaning their electrons have been stripped away, which is the defining characteristic of plasma.