I'm not generally in the guide-writing business, but the following is information I was collecting anyway, so I figured I might as well share. If you want a more general guide to WoW Pet Battle families, you can read one at Warcraft Pets or listen to one at the WoW Pet Battle Crew Podcast. Also, I tip my hat to the counter finder at Warla's Pet search, which helped remind me of a few abilities I'd forgotten, and is a good place to go if a specific NPC with cross-family abilities is giving you a hard time.
This list/commentary focuses specifically on pets that are especially suited to countering each family. Each pet family suffers increased damage from one type of attack. Each family's default attack type also deals reduced damage to one other family of pets - though this isn't a 100% guarantee of reduced damage since many pets will have some non-default abilities. Still, if you can get both of these on the same pet, you have a worst nightmare for demolishing most hapless NPC's.
Aquatic: Magic-family pets with Flying-type Attacks (clear winner)
Your winner here is the Jade Owl, crafted by jewelcrafters - which was the pet that started my work on this list. It has all the attacks from a normal flying pet, but it has the magic family type and therefore takes reduced damage from aquatic attacks. Note that this pet will be uncommon quality when learned, which means you will need to have a battle-stone if you want to upgrade its stats to rare quality.
The Enchanted Broom - which also needs a battle-stone if you want to upgrade it - also has a flying Sandstorm attack, which creates a weather effect which effectively negates DOT's (which some aquatic creatures use). I do like the Broom as a pet, but this attack is on a long enough cooldown that I don't recommend it specifically for use as a counter to aquatics.
Beast: Flying-family pets with Mechanical-type Attacks (no winner)
Sadly, there's no winner here. Mechanical attacks are very rare outside of mechanical pets. The only flying pet that has any mechanical damage is the Dragon Kite, which was from an old TCG set, but even then it's only the call lightning weather effect, which is no substitute for a real mechanical pet. On the plus side, at least your flying pets get to have reduced damage against one of the most common attack types in the game.
Critter: Humanoid-family pets with Beast-type Attacks (clear winners)
Here you have several similar wild pet options, including at a minimum the Stunted Yeti, the Flayer Youngling, and the Kun-Lai Runt. To be clear, you don't need a specialty pet to handle taming/killing of wild critters - if anything, their vulnerability to the near-ubiquitous beast damage is a huge downside to the family. That said, some of these pets can hit repeatedly and hard, so it's nice to have the option for NPC tamer battles.
Dragonkin: Undead-family pets with Humanoid-type Attacks (no winner)
The bad news is that the Undead are the smallest pet family, and - while some of them were humans in life - (almost) none of them have humanoid attacks. (The exception - the very hard to find rare Scourged Whelping has the Darkness weather effect - not a high damage item - and a very odd channeled attack that only does decent damage if paired with a different weather effect.) The mostly bad news - with a touch of silver lining - is that Dragons have a bit of a habit of breathing various forms of magic or elemental attacks - a surprising number have little to no dragonkin-type damage.
Magic is the more common variant due to the lore of Azeroth, and for magic-inclined dragons you do have the option of using a mechanical pet (strong defense against magic) with humanoid attacks - the Clockwork Gnome and the Darkmoon Tonk are two examples. Just be warned that if you do get a dragon that breathes elemental fire (as opposed to dragonkin fire) your mechanical pet is going to take a ton of damage very quickly. As long as you know precisely what you're up against - e.g. NPC pet tamers - this approach can pay off.
Elementals: Critter-family pets with Aquatic-type Attacks (arguable winner)
Technically speaking, there is a winner here - any of five snails which are critters and have a single aquatic attack. However, I'm reluctant to endorse this solution.
First off, the attack in question is a dive ability, which has a long cooldown because it's attached to a guaranteed dodge ability and may or may not have a diminished miss chance. (Josh suggests that he saw this with a similar flying ability, and I'm inclined to agree - but I can't see why just the flying version would be covered.) Second, and more to the point, critters are vulnerable to beast attacks which are both the most common pet family in the game and the most common type of cross-family attacks, because ANYTHING has some way of biting. Throw in the fact that elemental pets very commonly have healing abilities to patch themselves up while your big hit is on cooldown, and I suggest you'd be much better off just trying to burst them down with an aquatic pet.
Flying: Dragonkin-family pets with Magic-type Attacks (clear winners)
Remember how I mentioned above that dragons which do magic damage are very common for lore reasons? This works out poorly for flying pets.
A personal sentimental favorite is the Sprite Darter Hatchling, which was the very first and only minipet I owned for a number of years. Back at launch, each individual pet you purchased was a slot in your bags you were never going to get back, but this little guy was a reward for an Alliance questline that I completed - several times in fact - back in 2005. With no way to get the pet back if you deleted him, I was definitely holding on to this guy, and now that sentimental souvenir pays off in pet battles. (This factor is also the true brilliance of adding pet battles to WoW's existing cosmetic pet system - I already had this type of emotional investment from day one.)
Humanoid: Beast-family pets with Undead-type Attacks (arguable winner)
Humans are another mixed bag. Spiders and maggots/grubs both have undead-type life-leech attacks that make them generally good pets in any case. However, neither of these attacks are big damage burst that will demolish a human as quickly as the families where I've called a clear winner. Meanwhile, humans very commonly have non-humanoid attacks, so the defensive advantage is limited. That said, your spiders at least have the advantage of being good tough all-around pets.
Magic: Mechanical-family pets with Dragonkin-type Attacks (clear winner)
As with the aquatics, there is a winner if you're willing to have a pet crafted and then find a battle-stone to upgrade it to rare quality. The Mechanical Pandaren Dragonkin has a dragon-fire breath attack, and is also a generally good pet.
Mechanical: Elementals (clear winners)
Mechanical pets are the oddball in that they are the only family who take increased damage from the same family that they deal reduced damage to - the elementals. Presumably, this is to balance out some of their other family bonuses - they are generally hard-hitting, have a great passive ability (when it works, though it sometimes won't go off for reasons that are not documented), and deal extra damage to beasts (again, the most common family in the game). In return, your day can be totally ruined by any elementals.
As an aside, a pair of fellow mechanical pets - the Pandaren Dragonkin and the Darkmoon Zeppelin - were previously a surprisingly good workaround for mechanical pets until a change in today's patch 5.2. These pets previously had a spammable single target elemental attack to go with their decoy ability, which is great for blocking the really large hits mechanical pets can deal out with their wind-up abilities. Unfortunately, the ability in question - thunderbolt - was changed into an AOE with a cooldown, and Blizzard also greatly increased the cooldown on the decoy ability, so this is no longer recommended.
Undead: Aquatic-family pets with Critter-type Attacks (clear winners)
And finally, the mortal enemy of the no-longer-mortal is apparently... frogs and toads, as their tongues count as critter attacks. I guess a rain of toads is NOT a good day for the undead of Azeroth - adding insult to injury, these amphibians can even heal up while waiting out the one turn of invulnerability that undead get after being re-killed.
Most turtles will also work with the "powerball" type attack, though really I'd like something that hits harder on my family counter pet. Finally, though they don't have the advantage of being aquatic, I do have to put in a plug for my fellow Armadillo's.