For the first idea, you'd have to have some lethal protein or something that's specifically inhibited by the chemical of interest. Coming up with that might be even harder than the original problem. And even if you could, evolution wouldn't favor cells that produced it, since it confers no advantage. There's an energetic cost to making that protein.
For the second idea, again, evolution ruins everything. The competing organism would do just that - compete.