Why didn't China become a colony of anybody, unlike most other Asian countries?
I take it you mean why was there no "Scramble for China" in the 19th century. Excluding Hong Kong, ceded to Britain after the First Opium War.
The Second Sino-Japanese War makes an excellent case study of the problems of invading China. In 1937 China had a completely out of date military and an ineffective industrial base, and was fighting a civil war. Japan was clearly militarily far superior. After a series of defeats at the hands of the Japanese, Chinese forces adopted a Guerrilla strategy of attrition and through constant harassment denied the Japanese a decisive victory.
Bernard Montgomery, later compared such a war with an invasion of Russia:
Rule 1, on page 1 of the book of war, is: "Do not march on Moscow". Various people have tried it, Napoleon and Hitler, and it is no good. That is the first rule. I do not know whether your Lordships will know Rule 2 of war. It is: "Do not go fighting with your land armies in China". It is a vast country, with no clearly defined objectives.
The comparisons between the failure of operation Barbarossa and attempts to conquer china are evident. This sort of war would have been highly undesirable for a European power in the 19th Century. Their military superiority over the outdated Qing armies would not guarantee victory and any war would likely be a drawn out costly one. Undeniably, for organisations such as the British East India Company (who had been so keen on conquering India for profit) this would have made terrible business sense.
Much better to extract trade and diplomatic concessions as the British did during the Opium Wars
If by "colonize", you mean ethnicly and culturally take over the territory, like was done in North America and Austrialia:
This is one of the questions touched on by Jared Diamond's Guns, Germs, and Steel. The basic thesis is that Eurasians had an advantage due to their large shared pool of (termperate-climate) domesticated crops/animal technology, and large pool of nasty diseases they had long exposure to that those outside of Eurasia did not have any natural defence against.
As part of Eurasia, the technology imbalance was never great enough in someone else's favor against China. Since China shared the same disease pool as the rest of Eurasia, there was never going to be a disease that Chinese had no exposure to but a Eurasian colonizer did, to help thin the numbers.
Now if by "colonize" you mean conquer, like England did with India, then that certianly did happen to China. Two of their last three ruling dynasties were not ethnically Han (Yuan and Qing), and there were times that large parts of China were effectively ruled by either various European powers, or by Japan.
If the question is, why wasn't China colonized by westerners like India, there were several reasons.
China was arguably "colonized" by the Mongols and Manchus per T.E.D's answer, but succeeded in assimilating those conquerors. The differences between China and Westerners stood in the way of a similar thing happening between China and the British, or even China and the Japanese (who were "westernized" Asians).
A) china was enslaved for 2000 years.
1) chinese were the lowest class in mongol, manchu, xianbei, Khitan, Jurchen empires.
genghis khan's law, killing a chinese = killing a donkey, sorry to mention this.
2)jurchen took two chinese kings, and forced them walk naked on the streets. chinese kings had to call the kings of jurchen as uncle for about 100 years.
Men of chinese royal family were sold into slavery in exchange for horses with a ratio of ten men for one horse.
3) chinese king had to call the Khan of Khitan as father, grandfather
4)other two chinese kings of chinese were also taken by foreigners as slaves.
5) manchus ruled china for 300 years till 1911. the population rate was 100,000,000 chinese VS1.000.000 manchus.
6)then japan invaded since 1937-1945( including the chinese captial), and killed over 30,000,000 chinese. some references say japanese killed over 12-20 millions chinese
Russia and USA saved china , Otherwise china should ruled by japan now.