The IRS requirements at http://www.irs.gov/businesses/small/article/0,,id=98263,00.html note that one of the requirements for S corporations is that they be "domestic"-- what exactly does this mean? Does it mean "domestic" to the United States? Or does it mean "domestic" at the state level? The latter reading doesn't really make sense, but I just want to double check because the same term seems to be used two different ways...
In this particular case it means that it must be a US business. In other words a company incorporated in the UK could not make a sub-chapter S election for US taxes.
As an aside, for sub-chapter S election you can not have foreign investors.
You are correct that generally when the term "domestic corporation" is used it means a corporation doing business in the state in which it is incorporated; i.e. it's home state.
So for example if ABC Corp is incorporated in Delaware and does business in both Delaware and Maryland then it in Delaware it is a domestic corporation while in Maryland it is a foreign corporation.
This must seem quite confusing to non US businessmen as in common language a foreigner is generally someone from a different country rather than a different state.
You can take a look at this link for the definition of the domestic corporation.
Based on that definition to be an S-Corp in any state you have to do business in that state and be incorporated in that state with a physical presence in that state.
On top of this you might want to consult an accountant about S-Corp's ability of having foreign owners since I can't find the requirements for that.