A very good question.
Such a situation might arise if police have captured someone who has planted a timebomb which will kill hundreds of people when it goes off. The bomber tells the police when the bomb will go off, but refuses to say where the bomb is located, so the police have a limited amount of time in which to discover its whereabouts. The police now have a choice: they can continue searching in the hope of finding the bomb before it explodes, or they can torture the bomber in order to get the information.
Many might say that, in this situation, it would be permissible to torture the bomber until he says where he planted the bomb. The bomber will suffer, but the information gained from his suffering will prevent the suffering and death of hundreds of people. The suffering of one prevents the suffering of many. This is a utilitarian viewpoint, where deciding how to act is based on achieving the greatest happiness of the greatest number - the many versus the one.
However, there are good arguments which question this view. We may not know if the person being tortured is telling the truth - he might say anything in order to stop his suffering. Information gained through torture is unreliable - and not admissible in British courts. It may even be that the person does not possess the information for which he is being tortured. There is a good example of this in the film Marathon Man (1976) starring Dustin Hoffman.
Arguments that torture is always wrong (the absolutist view) are based on the idea that everyone has dignity, by virtue of being human. Humanity has this dignity regardless of who they are, or what they have done, and this dignity must be respected. Sister Helen Préjean, author of Dead Man Walking, suggests that every person is worth more than their worst act. Torture seeks to dehumanise people and, like slavery, treats them as objects to be used.
Article 5 of the Universal Declaration of Human Rights states that, "No one shall be subjected to torture or to cruel, inhuman or degrading treatment or punishment." The declaration was adopted by the United Nations in 1948. The U.N. Convention Against Torture states that "No exceptional circumstances whatsoever, whether a state of war or a threat of war, internal political instability, or any other public emergency, may be invoked as a justification of torture." This would seem to forbid the torture of the bomber in the example above.
Here are some other useful links on this issue: