There comes a point in every DM's tenure when he or she is, for some reason, be it lack of preparation or wily players unwilling to follow an adventure hook, caught without stats for a monster or NPC in a situation where those stats matter. Maybe you need to oppose a Bluff check, make a save against a charm spell, or just smack a PC in the face with a dire flail. It is times like these when one needs to wing it.
The general problem with winging stats, however, is that it can be distracting to the players if it's too apparent. When the game is running smoothly, it's transparent, and the players can take the roles of their characters without thinking too 'meta,' but when things get bumpy, the veil drops and the story loses some of its spark. To avoid this, it's best to improvise in a structured way, so as to maintain the players' sense of mechanical stability from behind the DM's screen.
The absolute easiest way to improvise a monster is to 're-mask' an existing monster. After all, without its description, a monster is just numbers, and those numbers can easily be described a different way. The stats for a constrictor snake can easily be used to describe an overgrown sewer worm, and a centaur's stats can be used with only a few minor modifications for a lesser drider. However, sometimes there's not a close enough analogue, and you have to do some real improv. But don't worry, because you've still got an ace up your sleeve.
Two resources make winging monsters and NPCs extremely easy for a D&D or Pathfinder DM, those being the Pathfinder monster creation guidelines (which should apply just as well to D&D 3.X games) and, for 4th edition D&D, the monster creation rules (page 184 of the Dungeon Master's Guide). Once you've decided on an appropriate CR or Level, these tables lay out most of the statistical aspects of an appropriate monster/NPC, and it's just a matter of painting over the mechanical framework with the suitable flavor.
Of course, those are just generic values. Especially in a 3.X/Pathfinder game, the PC's statistics can vary wildly from the expected values. To adjust for this, below is my personal methodology for coming up with combat statistics (these are 3.X/Pathfinder-specific, but you get the idea):
- Hit Points: Don't worry about these too much, just use the Pathfinder-suggested value.
- Attack Modifier: If the creature depends on attack rolls, give it an attack modifier in the ballpark of the party tank's AC — 12. This should give the tank a decent chance of fending off a given attack while making sure the monster hits every once in a while.
- Damage: Like with hp, the Pathfinder values should be good. With this you'll have to do some quick math to get the average damage to sync up with the dice, but it's okay if it's not perfect. Just don't throw down too much damage or you could unintentionally wipe the floor with your PCs.
- AC: Similar to before, I like to set the creature's AC based on the party tank. Somewhere around 8 + the tank's attack bonus (though this number could be higher if it fits the flavor).
- Saves: Generally assign one good save (two if it's a powerful monster), with the other two being poor. The good one should about about equal to its CR + 2, and for poor save just halve its CR.
- Skills: When a skill check is needed, decide if the creature would have it trained. If yes, use a bonus equal to its CR + 5 (add a couple more points at higher levels). A bonus of around half the creature's CR for untrained skills should be fine (this is a bit incongruous with the actual rules but better for game tension). Usually assign no more than four 'trained' skills.
- Other: Anything else can be improvised easily. Need a monster's CMB? Just use its previously-assigned attack modifier. Does it have energy resistance? If it fits the flavor throw a resistance of 5 or 10 on it. What about SR? CR + 9 should be about right. And so forth.
I hope this helps you DMs out there, and remember: It's a game, so never do more work than you have to!