If a spellcaster is trying to avoid being detected as a caster and is caught unprepared (e.g. nondetection is immediately unavailable), is there any way for them to sacrifice memorized spells or available spell slots so that they appear mundane to arcane sight? Note that casting and failing to successfully cast might be seen/noticed, but they would have about 10 minutes standing in line before they are scanned by arcane sight.
It wouldn’t help—arcane sight determines if the target has any spellcasting ability at all, and simply being out of spell slots wouldn’t change that. It would allow you to diminish the potency of “the most powerful spell [...] the creature currently has available for use,” but not eliminate the caster’s awareness of your general spellcasting ability.
There are options that could avoid giving away that you’re using up your spell slots, though.
Spells without focus, material, somatic, or verbal components are purely-mental actions, which means your spellcasting can’t be noticed. Eschew Materials, Silent Spell, and Still Spell can eliminate those components to achieve such a spell. And then Invisible Spell can hide the effects. If you are a spontaneous spellcaster with Invisible Spell, Silent Spell, and the flare cantrip, for example, you could go through every one of your 1st-level-or-higher spell slots in this fashion. If you had a metamagic-reducing effect, you could even get your cantrips too. But you would need to have these spells ahead of time, and they’d need to be prepared as such if you prepare spells—which is pretty unlikely.
Secret signs, found in Complete Arcane and Oriental Adventures, is particularly ideal here—the only component it has is a focus that merely needs to be on your person. It can be explicitly cast while bound and gagged. That skips needing the feats. And its entire purpose is to send messages that cannot be recognized by others, so just target an ally with it and no one will know you’re doing anything.
The problem is that only wu jen have access to the spell, and wu jen are prepared spellcasters. Even if you are a wu jen, you almost-certainly haven’t filled every slot with this spell, so it doesn’t help. It’s not clear that there’s any good way to accomplish spontaneously casting it as a wu jen or anyone else. Certainly not anything you’d expect your typical spellcaster to have available.
There are a number of ways to hide that you are casting spells, and if you have the Invisible Spell feat you might actually prepare every spell to be invisible since it’s a +0 adjustment (or if you’re spontaneous, you can just use them as such). This combination seems probably most likely to be available, to me.
Various feats burn spell slots for alternative effects. Arcane Strike, for example, burns a spell slot (of 1st level or higher) for a 1-round bonus on attack and damage. It doesn’t require that you actually attack or otherwise use those bonuses, so you could just use it as a spell-slot dump. It’s even a free action, so you could potentially go through all of your spells that way in a single round (or at least a big chunk of them, depending on when the DM decides to exercise their option to say you’ve used too many free actions in a round), though of course the bonuses don’t stack. But again, you have to have the feat—don’t have to worry about preparing spells for this purpose, which is great, but if you don’t have the feat you’re out of luck.
I haven’t been able to find an example of such a feat, but if a feat like Arcane Strike existed that was available to fighters as a bonus feat, you could use heroics to get the feat, and then proceed to dump your spell slots. Heroics is a pretty good spell, so knowing it/preparing it isn’t so unlikely. It has material, somatic, and verbal components, though, so unless you’ve got ways to get rid of those, casting heroics itself will be a give-away.
Various monsters consume spell slots, and negative levels cost you spell slots as well. A planar binding or planar ally effect might be able to get you something willing to drain you of your power—but it will be hard to keep it discreet.
Ultimately, all of these require some kind of resource you aren’t necessarily going to just have at your fingertips. Certainly, there’s nothing saying that a spellcaster can just drop their spell slots to no effect just because they want to. If you have Arcane Strike, you’re golden, but the entire premise here seems predicated on walking into a situation where you realize suddenly you need to ditch spell slots—and Arcane Strike is a fairly mediocre feat even for gishes. If you aren’t a gish, there really is no reason you’d have it. Likewise Silent Spell and Still Spell—the metamagic spell adjustment on them just makes it relatively unlikely that you’d bother, and if you have to prepare spells there’s almost no chance you prepared every spell using them. As I mentioned, perhaps the most likely thing is sleight of hand combined with Invisible Spell, but sleight of hand is cross-class for almost all spellcasters, and Invisible Spell is decent but not exactly a gimme, so there’s still pretty good odds you won’t have it available when you need it.
And again, even if you manage it, they’ll still know you’re a spellcaster, and know you’re just out of spell slots. Frankly you’re probably better off leaving your 1st-level spell slots there, so maybe you can masquerade as a low-level spellcaster—guards might assume someone with a few 1st-level and 0th-level spells is simply a 1st-level spellcaster. Someone with nothing at all is clearly just out, and could be anything, which might get guards wondering.
KRyan's covered most of the sane options, so I'll cover the insane.
Be a Mage of the Arcane Order
Your question forbids preparation, but this isn't an unusual prestige class for a Wizard to take and anyone who does take it will have a good chance of being prepared for these sorts of problems. I suspect that this is the closest thing to what you're after.
Once you are a Mage of the Arcane Order, you have access to the Spellpool. To use it, you need to have some spell slots left open, so you're already in a good position for this question. Furthermore, each use incurs a debt in spell slots that we can then pay to burn even more spell slots. If we're not already in debt, then we can call for more spells (up to a limit based on your class level) and then wait the required number of minutes for them to fade from memory (burning even more slots), and then we pay our debt to burn more spell slots.
Clerics can sacrifice prepared spells to cast a Cure/Inflict spell of any level. Swap all spells for spamming Cure Minor Wounds and now you'll look like the most pathetic of casters who is trying very hard to fix some back pain. If you're lucky, you'll burn all of your slots without your casting being noticed. For Wizards, Spontaneous Divination can do something similar. I suggest Detect Poison. The only problem here is disguising your casting; you'll have to work around the verbal and somatic components.
Stop being a caster
Are you a Cleric or Paladin? Grossly violate your code of conduct and your god will fix your problem for you. Are you an arcane caster? Go have some fun with Mage's Disjunction (hopefully Silent, so they can't see you casting) and you might not be one any more.
Take a serious hit to your casting stat
This one is probably on DM's discretion, but most casting classes can't learn, cast or prepare spells if they have a score of less than 10 in their casting stat. I suspect that dying will do the trick, but if that fails, maybe you can give a Wight in the line a great big kiss and let the level drain do the work. If you have to, it's possible to summon one (Summon dead V, IIRC), but you'll struggle to disguise that.
Botch an Epic Spell
You can burn spell slots to contribute to someone else's Epic Spellcasting. I don't recall any rules for what happens if you fail the DC on the Epic Spell, but if your DM is kind enough to rule that nothing happens, you can do rituals until you run out of slots. Just make sure to pay the additional costs to make the Epic spell lack noticeable components and to mitigate the casting DCs down to a level where you'll not be stuck casting for days.
Actually cast an Epic spell
Epic Spellcasting can do pretty much anything, so you might be able to what's suggested above without failing the skill checks. After all, if Epic Spellcasting can do anything, then I'm sure that you can develop an Epic spell that does absolutely nothing.