What happens without a government? City Downstream chips in for a bunch of guys to go up there and beat the shit out of the owners of that factory. Let's assume a scenario in which all citizens of City Upstream work for that factory, so they all want to keep their jobs and so they all chip in for a bunch of guys to protect them (or a company hires those guys on their behalf). Now, those guys meet up. Are they going to fight? Highly unlikely, because it is in their personal self interest to resolve this conflict peacefully AND collect the money from the people who hired them. What are they gonna do? They're gonna compare the balance of power. If it's equal then they're gonna settle for the solution that satisfies both equally. If City Downstream, which obviously is concerned with its health more than City Upstream workers are concerned with keeping their job, hires more tough guys, the balance of power would be in its favor and thus you can expect more drastic measures to be agreed upon. Then remember, we talked about an edge case, when all citizens of City Upstream work at a factory. However, that is very unlikely. Thus it may turn out to be that one factory would be up against the whole city.
Of course in reality, no one would actually hire tough guys, but rather such conflicts would be resolved through more civilized private protection agencies and courts. The central question is who outbids whom and to what degree. And the answer is that if the majority of people want something enough to pay for it, it will always outbid the minority, however rich this minority is.
You don't need no government to solve externality problems. All you need is to stop thinking that some magical entity, simply because you can vote for it, is able to resolve issues that are truly complicated.