I admit, this comes from the original “Independence Day” movie from 1996, but during the first dogfight scene one of the characters claims they can't breathe and takes their mask off. Another character tries to order him to put the mask back on. I assume that he couldn't just look into the other person's cockpit. Is it possible in such a scenario to know that another pilot isn't wearing their mask?
No, there's no mechanism to check if a pilot has their mask on. It's sometimes possible to hear the difference in how muffled the sound is. Other than that, it might just be that that particular pilot has a reputation for taking his mask off when he's not supposed to, and the other pilot just assumed that's what happened.