A Wizard must take an hour of uninterrupted time out of every day to memorize and prepare every spell that they're going to be using during that day. However, you can prepare spells around your gaps of knowledge.
For example, if you have four first level spells, and a number of cantrips, and during that day you cast Color Spray twice, Charm Person once, and still have a Burning Hands spell available in memory, when you prepare your spells the following day you would only have to prepare Color Spray twice, and Charm Person once. The Burning Hands spell will stay in memory until you expend it or expunge it from your memory.
The best way to think about it is to think about spells as a wizard as little coins that represent spells in question. You put the coins into a slot in a machine, which produces the desired spell effect. You no longer have the coin so you can't cast that spell anymore unless you have multiples of that same coin, and your coins don't replenish until you get your paycheck from the weave once a day, but you can't get in to get your paycheck if you've lost your badge (i.e., your spellbook).
The following feat may save your life as a Wizard if you take it once before your spellbook gets stolen:
Spell Mastery [Special]
Wizard level 1st.
Each time you take this feat, choose a number of spells equal to your Intelligence modifier that you already know. From that point on, you can prepare these spells without referring to a spellbook.
Without this feat, you must use a spellbook to prepare all your spells, except read magic.
With this feat if your Intelligence modifier is +7, you can choose seven spells you know and you won't need a spellbook to prepare them. If you don't have this feat and your spellbook gets stolen, you're powerless until you can get it back and can only rely on unused spells with which to recover your spell book.
But hey, on the bright side you can prepare Read Magic as much as you want without a spellbook.