Being a political party and not a state, Hamas cannot enter into treaties, no more than the local chess club can enter into a treaty. Depending on the political processes of Palestine (of which I have no idea) it might be able to withdraw The State of Palestine from the Rome Statute, but it hasn't done that so far.