Sometimes you just have to sweet talk the officials (know any Spanish/Guarani?).
Some will say you have to prove that you're a resident of the country in which you're applying, others will gladly accept your cash and then others will laugh at you...but that last one didn't happen too often.
A few different data points:
-I studied abroad in Tokyo, and the Vietnamese embassy had no issues giving me a visa. They didn't even care about the residency status. OTOH, the Indonesian embassy staff cursed at me.
-The Burmese consulate in Hong Kong simply said "pick it up later."
-The Indian embassy in Jakarta - I had a letter from a local contact but no residency status - asked for utilities bills, credit card copies...the whole nine yards. (Can't imagine what the US embassy would ask from me were I not already from there)
In other words, good luck!