Is it possible to work for a foreign company in China as an expat?

Hi there,

I am an Irish guy currently working for a Chinese company and have been with a B work permit for the past 3 years sponsored by the Chinese company I work for.  An Irish company has last week offered me a job working directly for them but living in China, the trouble is they don't know how we can work it and neither do I.

I am married to a Chinese woman and have been for exactly 2 years if that helps. Does anybody have any experience in this at all?  I guess my two main concerns are the visa required, and how they can pay me/my taxes either here or in Ireland.

They are willing to do everything and anything they can to secure me in the position.

Thanks in advance.

There are lots people who do exactly that.  Foreigners/Expats in China working for foreign companies.  In fact that's probably the majority of them.
But in order to get those jobs usually you have to be an expert in particular job that needed by that company here. And being bilingual with Chinese being one of your languages probably help as well but not absolutely necessary. 
Foreign companies with a presence in China bring in people from the outside all the time.