Without knowing your nationality, this is very much a hypothetical.
In addition to the answer by Choster, if you are an EU citizen you can receive consular assistance from any other EU representation if there is no national embassy or consulate.
No country has a diplomatic presence in every other country; in some cases politics prevents it, but in other cases it is simply impractical. Your home country will take care of its citizens’ needs in the destination country in some fashion, however:
For example, Latvia does not send a diplomatic mission to Vietnam, but it has authorized the Hungarian embassy to Vietnam to handle issuing visas to Latvia. By the same token, Hungary does not maintain an embassy in Cambodia, and Hungarian diplomatic and consular duties for Cambodia are handled by the embassy in Vietnam.
For another example of case #2, Bhutan and the U.S. do not maintain official diplomatic relations (even though they are otherwise friendly), and the U.S. sends no diplomatic mission to Bhutan. If you were an American citizen visiting Bhutan and lost your passport, you would need to contact the U.S. embassy to India in New Delhi for further instructions.
Case #3 applies where for political reasons a country does not send an official mission, but needs a presence there as a practical matter. It is not directly applicable to your question, but it is how many countries handle relations with Taiwan/China and Israel/Palestine.
Your home country’s foreign office is the only definitive source for understanding where you can find consular services in any part of the world.
Passports represent nationality, not residency. A green card holder (U.S. permanent resident) cannot apply for a U.S. passport, so you would be traveling on your home country’s passport, and if it is lost or stolen, you would need to contact your home country’s mission or their proxy to replace it. I doubt your U.S. status would make much if any difference there, but I cannot say definitively one way or the other.
addendum
As Michael Hampton notes in a comment, “US permanent residents can re-enter the US without a passport, but might or might not be able to transit various countries with only the green card. So it may be sometimes possible to return to the US and deal with it there. It’s best to deal with it immediately, in the country where it happened, though.”
Credit:stackoverflow.com‘