For archivists, wizards, and wu jen, you could simply read their spellbook (prayerbook). Though I suspect someone looking to commit a crime with a spell that is unusual enough that this line of inquiry was worthwhile would probably not include it in his main spellbook, but keep it separate.
For spellcasters who do not prepare spells ahead of time, a 13th-level spellthief can use Discover Spells to get the complete list. Note that this requires a successful Sneak Attack to accomplish. Being immune to Sneak Attack damage (e.g. elemental type, fortification armor, etc.), however, would not protect against this effect. For prepared spellcasters, Discover Spells only retrieves the list of currently-prepared spells, which is less useful.
For spellcasters that prepare spells based on their full list (clerics, druids, so on and so forth), a Spellcraft check or relevant Knowledge check should probably be able to get you that list. I’m not certain how to determine a character’s class spell list; classes are, after all, typically metagame constructs. This also wouldn’t help much if the character has any effect which adds unusual spells to his or her list.
And of course, various general-purpose divinations (commune, contact other plane, etc.) could also probably answer the question “does so-and-so know how to cast the spell x?” Which is why after a certain level such investigations tend to be very short in 3.5.
So far as I know, those are the only options.