A man who murdered his partner after she tried to hide in a bathroom has been sentenced to more than two decades in jail.