Although obviously HD and level aren't identical, for most humanoids HD is a strong indicator of level, so determining a creature's HD comes close. Included below are some such methods in addition to those to determine level proper.
The Knowledge (local) Skill
A Knowledge (local) skill check can be used to identify humanoid monsters; monsters isn't a game term, so it's up to the DM if the game means creatures instead. If the DM takes monsters to mean creatures then a Knowledge (local) skill check determines a humanoid's HD with a margin of error of 0 to -4.
Example: Lidda makes a Knowledge (local) skill check to identify a humanoid lurking in an alley. Her check result is 17. The DM says she remembers 1 bit of useful information about that creature. This tells Lidda that the humanoid has either 3, 4, 5, 6, or 7 HD. If the humanoid had 1 or 2 HD the DM would've had her remember 2 bits of useful information, while if the humanoid had more than 7 HD the DM wouldn't have had her remember any bits.
What information bits are obtained by this use of the Knowledge (local) skill--that is, whether Lidda receives information about that kind of humanoid lurking in the alley, or if she receives information about that specific humanoid lurking in the alley--is purely the DM's call and beyond this answer's scope, as is how this information is narratively obtained.
Improved Uncanny Dodge
A gang of increasingly high-level rogues can determine the level of a creature who possesses improved uncanny dodge by attempting to flank that creature. The rogues who succeed are 4 levels higher than the classes that grant the creature improved uncanny dodge. Druids and high-level rangers can give themselves improved uncanny dodge by having all 4 of Dragon Magic's primal spells on themselves at once; a cleric, wizard, or sorcerer can do the same with the 4th-level spell watchful ancestors (MoE 103-4). Determining the levels of bards, monks, fighters, and paladins this way would be, I think, impossible.
The soul bind spell reads: "While creatures have no concept of level or Hit Dice as such, the value of the gem needed to trap an individual can be researched" (PH 281), and that value is 1,000 gp per HD of the creature. The DM then makes researching this as simple or as difficult as the campaign demands.
Simple Example: Lidda wants to know how many HD that humanoid in the alley has. She goes to the local bar, makes a Gather Information check (DC 15) to find out about a specific item--in this case, a black sapphire expensive enough to bind the soul of the humanoid she just saw in the alley. If successful, she'll get that information.
Difficult Example: Lidda wants to know how many HD that humanoid in the alley has. She follows him back to his apartment, learns his name, finds out he's a member of the thieves' guild, breaks into the guild, decodes the membership list, looks at that thief's most recent jobs, and determines that he has a specific number of HD.
This assumes the DM doesn't say, "Magic spells require magical research," thus requiring legend lore, contact other plane, and and the like. This also assumes the DM isn't a jerk and just always says, "A black sapphire worth 1,000,000 gp will bind the creature's soul."
Spells, while none reveal exact level, can be useful in getting close.
A creature's type, race, subrace, and all subtypes are determined with the 3rd-level Clr spell know bloodline (LE 32); this lets the player know if the creature may have a LA. Race is tricky, though, and it's debatable what templates this reveals.
Creatures with auras (PH 32) are identifiable via the alignment-specific detect spells, but this method breaks down after the creature's level 11 or higher.
The 1st-level Sor/Wiz spell arcane sensitivity (ShS 44) reveals if a create can cast arcane spells and the highest level arcane spell the creature can cast.
The obscure 4th-level Sor/Wiz and Clr spell identify with flame (Dragon #308 23) has as one of its options revealing if creatures within the area possess levels in a specific character class.
A daze spell determines if a humanoid has 5 or more HD, and color spray provides more precise low-level indicators. At higher levels holy word and the like determines HD relative to the caster. A host of other spells have effectiveness based on the target's HD; some aren't even lethal.
The most precise method is the 1st-level Rgr spell detect favored enemy (SC 64), the third round of which gets their favored enemies' exact HD.