Metagaming - unfairly using out-of-game knowledge - is often a big problem in D&D and other pencil-and-paper role-playing games. Essentially, it's a subtle form of cheating.
Consider a video game - I'll use a well-known example, the original Quake. If you play the same level over twice, you'll likely do better the second time because you've learned from your mistakes - you know to fire a grenade around that corner, or to jump out of the way after hitting the switch because it's going to drop your section of floor into lava. The game is designed this way.
The problem occurs when this kind of metagame thinking occurs in a roleplaying game. Games like tabletop Dungeons and Dragons have no save points, strategy guides or walkthroughs. You can't quit and reload from the start of the level if you let the bad guy get away or lose a really good magic item. In short, if you know more about the game than your character does, it's unfair to use such knowledge.
Take the example of a group who, having played a game that ran up to level 20, retire their characters start a new game at a lower level. The characters face a creature which has a special vulnerability to something - silver weapons, perhaps, or fire. The players know this, but their new characters don't. Do they pretend they don't know of the vulnerability, or do they metagame and use it anyway? What if it's more serious - should a player be expected to risk almost certain death for the whole party, just because his new character has never heard that a medusa has a petrification gaze attack?
The best solution is for the DM (or Game Master, in an RPG other than D&D) to subtly change things, so that the player can't metagame. Trolls are vulnerable to silver, not fire. Medusas look like black-skinned, raptor-like beasts that spit a venom which causes petrification. Vampires don't give a crap about silver or garlic, but are burned by wooden weapons. With a few tweaks here and there, the game can be made more interesting for the players, as well as taking away most of their incentive to cheat.
Of course, when you run a pre-written adventure there's the possiblity of one of your players having read it already. This would be considered by most, blatant cheating. In the event that you're running a game and a player starts getting uncannily good at guessing where the treasure is hidden, you're within your rights to attack him with an empty coke bottle or some kind of foam bat.
The following is a good example of a gaming group who were seduced by the dark side. Er, metagaming, rather.
As the druid dispels the deeper darkness spell that has blinded the party, the wizard's powerful magic makes light work of the evil Mind Flayer. Where the monster once stood, there is now a rather bemused looking frog - protected by a towering mechanical bodyguard.
Wizard: Fighter, kill that thing. I want the Illithid Frog for my collection.
Fighter: Hey, DM... is metagaming a free action?
DM: It is... but it's highly, highly frowned upon by certain great powers. *grins*
I turn to the wizard's player. "I've read the Monster Manual. This thing sounds like a Shield Guardian. All you have to do is kill the frog, and it'll turn back into a dead Mind Flayer. Take the amulet around his neck and wear it, and you'll control the Shield Guardian. These things are worth upwards of 100,000gp - and that's just the cost price."1
Metagaming as it is, the wizard ought to know this fact about Shield Guardians, and the DM allows the conversation. A similar thing happened when my player had the idea to use scrying to contact someone - something the wizard's character might've thought of, but the wizard's player hadn't. Metagaming is why our party no longer tries to burn a Baatezu or ghoul touch a mithral golem.
DM's note: Unless you have taken the feats Speed Reading and Noding Prodigy, amusing yourself with the above story is at least a full-round action.
Update (20/Oct/2003): This was one of my earliest (and lowest rated) writeups, so I decided it needed a rewrite. Everything before the <hr> is new stuff, the anecdote was the old writeup.
1 Thanks to the wonders of the Internet, I managed to ask the author of this adventure if he meant for players to be able to take the Shield Guardian. I'm not sure, but I think he was mildly impressed at my ingenuity.