You can't tell by looking, and it's an issue that occurs naturally, not just because of industrial contamination.
Even if you're hiking in a pristine environment like a national park, where this kind of man-made contamination isn't likely to be a concern, there can still be contamination from naturally occurring substances like arsenic.
Natural blue-green algae can also produce toxins that can make you sick, and treatment will not get rid of the toxins. Even after an algae bloom has died off, the toxins can remain in the water if it's stagnant, so there is no way of telling by looking at the water that there's a problem with toxins. All you can do to protect yourself is avoid drinking from stagnant water sources.
In an environment that's not pristine, such as farm country, industrial contamination is only one of many possible hazards. You have to worry about contamination from livestock and fertilizers, and so on. Again, you can't tell by looking at it whether it's contaminated.
Some common-sense precautions:
- Don't drink from a stagnant source.
- Don't drink downstream from areas where there could be livestock or pack animals.
- Ask local people if there are any known issues, e.g., whether they have wells that they can drink from. If in a semi-populated/semi-protected area like a national forest, ask a ranger.
- The big thing that makes backpackers sick is not contaminated water, it's poor potty hygiene. Make sure your hiking partners wash their hands after pooping, so that you don't get sick from hand-to-mouth contamination with their gut flora, which your own body doesn't tolerate like it tolerates its own.