At that point it's only a matter of beating your competitor to market with a better product. Just because someone happens to be developing the same thing doesn't mean you can't make money from it yourself. It's classic free market competition. If you're worried about them patenting something you've developed yourself independently, make sure you publish your prior art as soon as possible (or beat them to the patent office).