Here's how I managed to get my HP 5510xi all-in-one printer working wirelessly when connected to a Time Capsule. First, you need download the open-source Linux drivers for HP printers from this page. Make sure you download the hpijs package, but also download the Foomatic-RIP and ESP Ghostscript packages from that same page.
Install the Footmatic and Ghostscript packages, then restart your Mac. You will not be prompted to restart, but it is necessary before you can install the hpijs package. After the restart, install the hpijs package, and restart again. Now go to System Preferences » Print and Fax » Add Printer (click the '+' sign).
In the Add Printer window, select IP at the top of the window, and use the following settings:
Mac OS X Hints
http://hints.macworld.com/article.php?story=20080515053023500