It is a fact: over the last few years, there have been more foreigners moving out of China than moving in.
The exodus of foreigners has been especially pronounced in Beijing, and even the Chinese media has reported on this (here's an English translation, and here's the original). But the situation is essentially the same all over the country: foreigners are leaving in larger numbers than they are arriving. A new study by a company which helps relocate expats has confirmed this trend, claiming that in 2014 twice as many expats left China than those who arrived.
Most of the articles covering this phenomenon, including the Wall Street Journal one linked above, note a few specific reasons behind the trend. First of all there is the dreadful air pollution, which has only worsened in the last few years, and is scaring people off. This factor looms especially big in the case of Beijing, where the air quality is way worse then it is in Southern cities like Shanghai and Shenzhen (where it's still pretty bad, by the way). Then there is the slowdown in China's economic growth and the rising productions costs, which may be pushing some multinational companies to relocate elsewhere in Asia. Finally there is the rising cost of living in China's big cities.
All of these factors seem perfectly plausible to me. Living in Beijing, I personally know people who have left due to the pollution. Costs of living have risen, especially if you want to maintain a decent lifestyle: you have to pay for expensive air purifiers to keep your flat breathable, you have to shop for imported food if you want to be certain of its safety, you have to take taxis rather than the subway in order to avoid being driven crazy by the crowds etc... Rents in the major cities are now almost as expensive as they would be in Western Europe, and healthcare at international standards costs a bomb.
I am surprised that none of the articles on the exodus of foreigners mention another obvious annoyance of life in China: the censorship of foreign websites, which has become more and more extensive over the last few years. Even though there are ways to get around the firewall (but it's getting harder), it still complicates the lives of foreign expats and serves as a constant reminder of the sort of system they are living under.
This leads me to another factor which looms big, although it isn't usually mentioned in a direct fashion: there is a distinct feeling that China is no longer as welcoming as it used to be for foreigners. This begins at the institutional level. It has become harder and harder for foreigners to receive Chinese work visas over the last few years. This is partly a matter of the rules themselves becoming tougher, and partly a result of the pre-existing rules being applied more strictly (in China one always has to look at how the rules are applied, and not just at what they say on paper).
Both international and Chinese companies are now more likely to try and recruit local talent for positions for which they previously recruited expatriates. This is partly due to the large numbers of Chinese who have returned from studying abroad and are assumed to have a good grasp of international business culture. But it is also due to how difficult it has been made to recruit foreigners. Chinese companies especially are only allowed to employ foreigners under very specific conditions which are hard to meet. And while in the past it was fairly tolerated for foreigners to work on a business or even a tourist visa, the authorities have now become stricter on this front too.
The truth is that those in power have never viewed a multicultural society or the integration of foreign immigrants as desirable goals. The presence of foreign nationals working in China is seen more as something to be tolerated if it helps the country develop. Foreigners are in China to the extent that they are needed, but they do not acquire any kind of stake in the society. If there are Chinese who are capable of doing the same jobs, then it is preferred that Chinese do them. Of course attracting talented immigrants would appear to be a hallmark of most successful modern countries, at least in the West, but as far as the current Chinese government is concerned the benefits just do not outweigh the hassle of integrating all those un-harmonious foreigners.
Receiving a permanent residence permit is extremely arduous for a foreign national, and receiving Chinese citizenship practically impossible (and not too desirable, especially since you would have to give up your own citizenship in the process). No matter what you do in China, you will eventually be confronted with the fact that you have no permanent basis to reside in the country. Visas have to be renewed at least once a year, and if you want to change occupations you will have to consider what your chances are of getting a new visa in time. Constant "visa runs" to Hong Kong are obviously not a safe and long-term solution (then again, Shanghai has just announced new rules making it easier for foreigners to get permanent residence permits. What this will mean in practice remains to be seen).
I also think that the worsening political climate is playing its part. In the old days (say the first decade of the 21st century), there was a distinct feeling among foreign residents that China was on a path towards becoming a more open and liberal kind of country, slowly but surely. With this belief in mind, people could tolerate a lot. Nowadays that feeling has basically gone, at least among those who take an interest in Chinese affairs. The current atmosphere of repression (which has caught even the odd foreigner in its net) and the mounting populistic nationalism are not exactly encouraging people to remain in the country.
All of these factors, I am convinced, are pushing people to seek their fortunes elsewhere. In the long run, the loss will mostly be China's.