I spent a while in the countryside in ivory coast, and at first, I only drank bottled water.

But really there are plenty of ways to make sure you don't get sick.

First: assess the risk. What water are the locals drinking? Is it from a well? Is there a pattern of people getting sick? What do they think? I've been in communities where I just ended up drinking the well water and never had a problem, because I became pretty sure that was the safest water around. Turns out the locals bottling the water didn't do so in the most sanitary of conditions. I only learnt that from locals.

Second: Iodine tablets. If you need to have water, yet you don't know of any reputable source, iodine tablets can work well. Some filters are pretty well rated too.

Third: Consider water that has been boiled (like tea, not caffeinated - caffeine tends to dehydrate you), or sodas. In Ivory coast I could always buy a coke, even in the remotest of places. Super unhealthy in the long term, but it won't make you sick right then and there.

If you're planning a trip, don't worry about it too much. Maybe bring a filter and iodine tablets, then use your best judgement while there. The more experience you get the less you'll even think about it.