Hello,
if it is a mob you could add a lot of defense/absorption or (and) hp + block to it. It is still possible to attack, but with very low damage (should work). You can also add a %HP or %Time skill with certain duration if you wan't to add it temporary (e.g. def 1000% increase) (should work). Same if it is some kind of structure.
You can also try to "clone" the treasure box of haroeris/seth, because it comes with immortality (not tested). At least there is nothing related to "can attack"
Maybe give us a hint to what kind of "something" you want to add immortality.