When someone says that something doesn’t hold water, he or she is trying to suggest that an argument, plan, or statement has some sort of logic flaw, and is either plainly untrue or wrong. The term is usually used to undermine something someone is saying and normally has a negative or insulting connotation. There are many different situations where the term might be used, including disagreements, as a response to poor excuses for bad behavior, and as a way of correcting someone who’s made a mistake with a plan.
The use of the term "hold water" as an idiom comes from a basic metaphor involving various containers. If a jug or barrel is airtight, it passes the most basic test of reliability for the purpose of transporting liquid, and during times when items where handmade, it was more difficult to make reliable containers, which meant the ability to hold water was generally considered more valuable. A container — like a bucket, for example — that constantly leaked water would have been hard to recognize by just looking because small flaws and pin-holes that would allow liquid to pass might be very tiny. The metaphorical connection to the trustworthiness of a container and the way water can easily reveal the quality of construction is generally tied to the full meaning of this idiom.
Often, people use "hold water" when they want to put the reliability of an adversary into question, either suggesting the person is dishonest, misinformed, or incompetent. For example, a politician could suggest that his opponent’s ideas didn’t hold water, or a lawyer could try to suggest that the opposing defenses arguments didn’t hold water in a criminal case. In many situations, these kinds of usages might also be combined with an insinuation that the opponents are aware of the flaws in their thinking and are perhaps trying to get away with some kind of deception. From a metaphorical perspective, their argument is being compared to a water jug that looks reliable but actually has small leaks that aren’t immediately visible.
Another very common use of the term "hold water" is to shoot down someone’s excuse. For example, if a child is caught misbehaving, he or she might try to come up with a wild story to explain the behavior and avoid trouble. The mother or father in this situation could inform the child that his excuses didn’t hold water, letting him know that his fanciful tales weren’t fooling anybody.