Apparently that is not the case. The Court of Appeals of the Federal Circuit has decided otherwise (see paragraph 36).
"A reference is no less anticipatory if, after disclosing the invention, the reference then disparages it. Thus, the question whether a reference "teaches away" from the invention is inapplicable to an anticipation analysis."("Anticipatory" is the legal term for being obvious based on the prior art). Worse yet, this dates back to 1998. I've been in the dark for a long time.
This is another example of how patents should be left to the lawyers. There is plenty of bad advice floating around from scientists and engineers, and obviousness is probably the biggest snakepit of all. Given that, my standard operating procedure has always been to assume that any invention is unobvious until someone with authority tells me otherwise.
Knowing this decision will not change how I approach a problem. When the suggestion is given to avoid a certain direction, I've found that quite often that advice is an opinion based on what the person thinks will happen, not something backed with evidence. I've seen it in my own "advice", where I say (with an appropriately boisterous voice) "Oh no, that'll never work". I've learned the hard way how much joy Mother Nature takes in showing my opinions about chemistry and engineering are wrong, so I'm glad to see she is an equal-opportunity destroyer-of-opinions and not just picking on me.
[*] What's with this "ordinary" description? In my mind, "extraordinary" would be better. (Ha ha!) Actually, the patent law talks about "obviousness" and other issues as being in the view of an ordinary practitioner, hence the term.