I have a BT Hub 2 and the power cable is damaged but I cannot remember if my hub is still under warranty
I presume you mean a BT Smarthub 2 and not a BT Homehub 2 as the Homehub 2 is now very old and no longer issued by BT.
As long as you are a still a BT Broadband customer call BT Customer Services 0330.1234.150 and report a fault and they will send you a replacement.
If however you caused the damage they may charge you for the replacement cable.