If you have been to Spain before, you should be well aware that the party will last well into the morning hours... therefore, you don't really need a place. I stayed for two night, two years ago without a room. The first night was no problem, I was up all night and still wide awake to watch the bulls run. The second night was not as enjoyable, I like to party, but I think I died out at around 4 am which left five hours until my bus arrived.
Also, a good way to get from Madrid to Pamplona is via the bus or a bus/train combo. When I went, I left from Burgos in the morning and took the bus to Pamplona and arrived in the early afternoon.
Good luck! Be sure to give a full report when you get back!