When we have a molecule, we have to identify if it is a charged molecule (ions) or a neutral one. If it doesn't have any sign of + or -, it means that the molecule is neutral, so the charge is going to be zero.
In this particular case, we have the nitrogen gas:
[tex]N_2\text{ \lparen g\rparen}[/tex]As we can see, it is a neutral molecule, so its charge has to be zero. As it is a molecule composed only of one element, then the oxidation number has to be zero (0).