Two ways. The immediate fix is to pickpocket a mercenary — lift from the right target and you restock your knives on the spot.
The longer-term fix is progression: complete a few more assassinations and Altaïr's maximum knife capacity increases. So if you keep running dry, either work the crowds for a refill or push the story forward and raise the ceiling permanently.