How to do zero damage Terraria?

This is impossible. Per the wiki, the minimum amount of damage you can do to enemies is 1.

You can see this for yourself by fighting a Dungeon Guardian. They have 9999 defense, which means they reduce incoming damage by ~5000. Even the strongest weapons in the game don't do that much damage, which means that theoretically it cannot be damaged at all. However, every time it gets hit, it still takes 1 damage, which makes it killable (though very, very tanky).