In the Gopaka-Moggallana Sutta (MN 108), Ananda points out that the Buddha didn't speak in praise of all types of meditation:
“The Blessed One, brahmin, did not praise every type of meditation, nor did he condemn every type of meditation. What kind  of meditation did the Blessed One not praise? Here, brahmin, someone abides with his mind obsessed by sensual lust, a prey to sensual lust, and he does not understand as it actually is the escape from arisen sensual lust. While he harbours sensual lust within, he meditates, premeditates, out-meditates, and mismeditates. He abides with his mind obsessed by ill will, a prey to ill will … with his mind obsessed by sloth and torpor, a prey to sloth and torpor … with his mind obsessed by restlessness and remorse, a prey to restlessness and remorse … with his mind obsessed by doubt, a prey to doubt, and he does not understand as it actually is the escape from arisen doubt. While he harbours doubt within, he meditates, premeditates, out-meditates, and mismeditates. The Blessed One did not praise that kind of meditation."
This seems like an obvious answer; just because something is called meditation doesn't make it wholesome. A hunter may spend his time meditating on how to catch a deer (pre-meditated murder), or one may spend an entire sitting meditation fantasizing about sensual pleasure.
A common example of this is the case where a meditator gets stuck on the ten vipassanupakilesa (imperfections of insight), like visions, rapture, quietude, etc., and mistakes them for the path. As a result, as you have read, a meditator can spend years basically going nowhere, just using meditation as an escape into these pleasant but meaningless experiences.
What isn't so clear cut, perhaps what you are really asking, is whether there is any condition that arises in meditation that one should avoid when cultivating wholesome meditation (proper samatha or vipassana). In this case, the answer is generally "yes" for samatha and generally "no" for vipassana.
In samatha meditation, where the object is absorption, one should avoid a great number of things; anything that is an obstruction to calm. Noises, pain, sickness, even indigestion, can all get in the way of your attainment of calm. Sitting in the wrong position can be an impediment, so the Buddha recommended the full-lotus with one's back perfectly straight. When one's mind enters into unwholesome thoughts or emotions, one should avoid such mental activity, replacing it with its opposite or coaxing the mind back towards wholesomeness.
As catpnosis points out, one should also not practice samatha against one's character type; a person of angry character should avoid asubha (loathsomeness) meditation, for example.
In vipassana, where the object is insight into reality, almost every experience is a valid meditation object; almost, because there may be cases where an experience may be physically harmful to the meditator (e.g. dangerous situations or physical injury) or a cause for cultivating unwholesomeness (e.g. getting caught up in obsessive thoughts or emotions). In some cases it is necessary to change one's posture from sitting to walking or vice versa to deal with these situations.