Romania's prime minister has resigned after his party withdrew its support amid a power struggle with the party chairman.