This has happened to me before.
It's all in your head, there's nothing wrong with you at all physically.
Basically your problem comes down to comfort (or lack of it), nerves, poor preparation, and self-conciousness.
Your mind didn't feel comfortable in the situation, so basically everything just shuts down. Then you throw nerves in the mix and that just makes the situaion worse. On top of that, you were unprepared and didn't bring a condom with you. Of course, your brain, as a defense mechanism will stop anything from happening. On top of that, you're self concious because you have a lack of experience and you're afraid you won't be able to please her, so you psych yourself out mentally.
The next time you're in this kind of situation, be prepared physically and mentally. Make sure you have protection and prepare yourself physically. Relax and just enjoy the moment.