Instead of going directly to the school principal, you need to talk with your son's classroom teacher and ask her how the students were selected to participate.
It could be that only a certain number from each class were allowed. Maybe your school has guidelines/rules on how they pick those who participate. You may find out that there are many 2nd graders who have a very high average in spelling--maybe higher than your son's and the others who were disappointed. The teacher may not have had any say in who should participate--she had to follow the rules.
I'm sure your son and the others were disappointed. It is too bad that a letter was not sent home explaining how students were chosen to participate. That might be a suggestion to give to the teacher for the school to use next year. That would eliminate any misconceptions and parents could talk with their students and help them handle their disappointment.
Do the best spellers always get into the spelling bee, even when a classroom contest is held? No. Kids get nervous, excited, hurry, are sick, etc.
Please do not go directly to the principal. Start with the classroom teacher and approach him/her in a calm manner. "I wonder if you could explain to me the guidelines for selecting spelling bee participants." Do not attack--as I stated earlier, she may not be in control. I would also do this away from the students.
Help your son deal with his disappointment. This will pass and life will go on. Next week it probably won't be a big deal anymore. If you keep on being upset, he will be too. You need to help him deal with disappointments constructively and learn life goes on, rather than "mom" will fix it or help him have a pity party. Yes, I know he is only in 2nd grade and this may sound harsh to some for me to say this, but in my years of teaching and working with kids I have seen the results of parents rushing in to "fix" or "protect " their kids from disappointment.
His feelings are going to be hurt many, many more times as he goes through school. As I said, work with him on handling disappointments. Let him talk about it and help him to move on.
Keeping him out of school rather than going to the spelling bee would be pointless. What will that teach him other than being a bad loser? Or that if things don't go your way, run and hide? Or avoid the situations? If he had been the one selected, would you like the other parents to keep their children home and not watch your son????? I don't think so!
How did you handle the situation when he first told you? Did you listen and respond empathetically, then help him move on? Or did you get mad and help him feel sorry for himself? Stop and think about this. Are you more upset about this than he is?