Of all the countries in Southeast Asia, Siam (or Thailand) was the only one to avoid being colonized by a European power. The British colonized Burma, the French colonized Indochina, but Siam remained independent.
The most commonly cited reason for this is that the Siamese rulers gave concessions to Western countries, particularly Great Britain. By getting these concessions (mostly to do with trade) the British got what they wanted from Siam without having to do to the expense of maintaining colonial rule.
Traditional histories also argue that the Siamese monarchs were skilled diplomats and that they modernized their country in ways that helped avoid colonization.
Through negotiations and by willing to compromise with the colonial powers. King Rama V also went on a European tour and was able to make friends with many of the European leaders and monarchs. Upon his return to Siam, everyone in Siam dressed like Europeans.