Hi, Joe. Is this the Midnight Mass on Christmas Eve? It's a popular joke among Catholics -- "what time is the Midnight Mass in your parish?" Is it in fact starting at Midnight, or at an earlier hour like 10:00pm? You will need to know this beforehand. Your hotel concierge will be up to date if this changes; just keep in touch with him/her.
Assuming the Mass in fact starts at Midnight, then I would recommend finding a restaurant in the vicinity and getting dinner (which the Italians call "cena", pronounced CHAIN-uh) at 7:00 when the restaurants open. You could find a restaurant in the Borgo Pio district, or near the Piazza del Risorgimento, or near the Largo di Porto Cavalleggeri. At whatever restaurant you choose, just let the waiter know you're attending the Midnight Mass, and that you need to leave by 9:00. If you're anxious about getting to St. Peter's Square sooner, you could find a place in these areas that serves sandwiches or pizza, and bring the food with you to the Square. It's probably best to eat before Mass, which won't end until 1:30 or 2:00 in the morning.
On the other hand, if the Mass starts earlier, say around 10:00, then you could possibly wait to eat dinner until after Mass. Many restaurants, but not all, may still be open. Again, it's good to consult your hotel concierge.
It's hard to determine when people will arrive at the Square. Certainly, around 3 hours prior to Mass, the crowds will start to thicken, and there may even be a long line waiting for security to let people in through security. That will probably happen about 2 hours or 90 minutes before Mass.
It's festival seating inside St. Peter's Basilica. I will be blunt. Prepare for culture shock. As soon as security opens up, there will be a mad rush to get in. Just use common sense and politeness as you make your way through. But don't linger. Keep up the pace as best as you're able. Once inside the Basilica, keep in mind that everyone will want to get as close as they can get to the altar. Is it worth it to follow the "Christmas rush"? What I've done in the past is to find a seat further back in the church so I can get as close as I can get to the main aisle, which will be cordoned off. When Mass begins, the Pope and his entourage will process down this aisle, and it's likely the closest you will ever get to him in your entire life. You won't see much of the Mass, but at least you'll see the Pope pretty close at the beginning and the end. And you can get pretty good pictures of him. Otherwise, follow the mad dash up front to the sanctuary, but don't be disappointed if even up there you can't get close to either the altar or the Pope in the procession.
This will be prime time for pickpockets. Be alert, and use a lot of common sense. Unless you have religious items (e.g. Rosaries) to be blessed by the Pope at the end of Mass, don't bring any bags or other items. Follow Rick Steve's advice about pickpocket scams to be aware of.
Dress code will probably not be an issue, as it is December, and you'll want to dress warmly. I hope this info is helpful. Please let me know if I may be of further assistance.