Urban druids can have a manufactured object like a gear or a horseshoe as a divine focus, and their companion creature can be a small animated object. Is there anything stopping them from having an animated hammer (or even an animated sword) that follows them around, which they can command to attack at a distance, swing as a regular weapon, and also grasp to cast divine spells?
Strictly speaking, an animated object is a creature and not, per the rules, an object. There also aren’t really rules for picking up cooperating creatures, so it’s not really clear how you would grasp it to use it as a divine focus.
That said, it certainly seems fitting, and making up rules to cover picking it up shouldn’t be hard (could just treat it like an inanimate object, i.e. a move action). You would have to talk to your DM, but I suspect most would be fine with it.
The biggest problem, really, is that it’s a pretty hard self-nerf: if you need your divine focus, your companion can’t be off doing other things. If your companion is off doing other things, you can’t use anything that requires a divine focus. And even if the companion stays nearby, you add a move action to the casting time of spells that need a divine focus, which is pretty rough.
So even if your DM allows this, I would strongly recommend that you also have a regular divine focus, and save this trick for situations where you lose that divine focus.
Besides the question whether it is okay to have a creature serve as a divine focus (already covered in KRyan's answer) one should keep in mind that a divine focus „is an item of spiritual significance“ (PH, 174) that reflects the urban druid's faith.
An urban druid’s divine focus is typically a manufactured or forged item common to a city, such as a gear, a tool, a horseshoe, or a similar item.
Urban druids find destruction and entropy to be the most horrifying aspect of the world; anything that can destroy a city is to be hated, feared, and hunted. (…) Their spells are oriented toward society and construction.
(Dragon Compendium, p. 57 (and errata))
So if you chose a weapon as a divine focus it should be one that can also be used as a tool for crafting or constructing to symbolize the idea of building and maintaining a city. As a DM I would approve a light hammer — but a sword would be a rather doubtful case to me.