In the United Kingdom, the prime minister does not need to ask the queen to declare war. The royal prerogative is a body of powers and privileges that belong to the monarch and are exercised by the prime minister in the monarch's name. These include the power to declare war and peace.
In practice, the prime minister does not usually make such decisions without consulting the monarch. However, the monarch is constitutionally bound to follow the advice of the prime minister, and so the decision to declare war is ultimately made by the prime minister.