Formation of ammonia from air and moisture
If you're absolutely sure it's Ammonia ($NH_3$) you're smelling, it's probably from you. 

Ammonia will not spontaneously form at any significant rate from the air. Molecular Nitrogen ($N_2$) is extremely stable. 

What can happen is that during marathon-type activities, muscles turn from carbohydrates (which are later converted into glucose and enter into the Krebs Cycle) as an energy source to proteins themselves.

One of the waste products of protein catabolism is Ammonia, which is excreted in your sweat if the body can't convert it into Urea ($CH_4N_2O$) quickly enough:


  Ammonia forms with the oxidation of amino groups (-NH2), which are removed from the proteins when they convert into carbohydrates. It is a very toxic substance and only one nitrogen atom is removed with it. A lot of water is needed for the ammonia excretion.