I fly into Madrid too. I'm taking the morning train (about 10:30 or so) and arrives in Pamplona at 13:35 (all times are estimates since I don't have my itenerary in front of me). From the train station we are taking Express Bourricot to St Jean. They are a private company that transports Pilgrims, and their schedule is a lot better than the bus. Contact them and to see if they can arrange to pick you up. However, according to their website they cannot transport within Spain, Pamplona to Roncevalles for example.
When you book your train tickets, do it through the Renfe website, look for the "turistas prices, when you click you that it may offer (if available, web fares and estrella fares) they are 40-60% less than the normal fares. You have to do it in Spanish, so good luck, I got what is normally a 56.00 Euro ticket for 33.00 Euros.