Wizards, clerics, and other full casters can leave a spell slot open, and later in the day study or pray or something similar for an suitable length of time, and fill the open slot with a spell.
Do witches have the same ability?
This has been answered in a FAQ:
Preparing Spells in Open Slots: The Magic chapter says a wizard can leave spell slots open and prepare spells in them later. Can any other class do this?
That text was written when wizard was the only class that prepares arcane spells. This option is also available to magus and witch characters (both of which are classes that prepare arcane spells).
This extends to other prepared casters that were released in the last few years. Assume that the text in the core rules say prepared arcane casters instead of wizards.
Preparing Wizard Spells
When preparing spells for the day, a wizard can leave some of these spell slots open. Later during that day, he can repeat the preparation process as often as he likes, time and circumstances permitting. During these extra sessions of preparation, the wizard can fill these unused spell slots.
The same can be said about clerics, druids, rangers and paladins. They named all the classes that prepare spells at Core Rulebook, but they never mentioned anything about that for the Witch (Advanced Player's Guide) or the Magus (Ultimate Magic).
But why am I talking about the Magus? Because the Magus prepare his spells as the same way a Wizard does, being able to prepare from a Wizard spellbook and even so, never states clearly that he prepare his spells as the same as the Wizard. However, the Magus is an Arcane spellcaster and his text explanation refer to the Arcane Spells part in the Core Rulebook that only speaks of the Wizard, Bard and Sorcerer (but the last two don't prepare spells).
If the Arcane Spells explanation of the Wizard way of preparing spells is applicable for the Magus as an arcane spellcaster that prepares spells, I believe the same is valid for the Witch that belongs to the same category. The main difference would be spending your time studying your spellbook or communing with your familiar.