I am starting this answer where @Andrew has stopped.
Consider the scenario in which your moral obligation to protect life is pitted against your moral obligation to tell the truth. Protecting life is the weightier moral imperative of the two, and thus lying to protect that life would be the right thing to do.
In truth no lie in deception is really good. For instance: You tell someone their hair looks good when it doesn't. Some day they will realize they look stupid and wonder why you said it was good. Or say a husband lying to his wife about their financial situation, if his purpose for doing so was good that is to prevent her from worrying. Note that there is a deception involved which when the truth is known, will hurt them.
On the other hand consider the following:
You are planning a surprise party for a family member. In order to keep it a secret, you have to lie about where you are going, what you have in the bag, what you spent your money on, etc. When the person for whom the party is being thrown learns that they were told untruths in order to keep the party a surprise, do they respond, “I can’t believe you lied to me!”? No, they do not think you have done anything wrong. Note that there is no deception involved here which can be hurtful later when the truth is known.
Those are the real life situations. Yet to know the right Christian perspective I did a long search and found this very useful information on the subject here at http://www.catholic.com/magazine/articles/is-lying-ever-right. It was very interesting and briefly I will try to summarise it:
St. Augustine in his treatise on lying (De Mendacio), cites the case of a holy bishop, Firmus of Thagasta, who wished to protect a man who had sought refuge with him. The bishop was so careful of the truth that, rather than lying to the imperial officers, he told them frankly that he would not reveal the man’s location. Firmus maintained this resolve even under torture and emperor was so impressed with the bishop’s virtue that he both praised the bishop and pardoned the fugitive.
Augustine tells this story to note that God is perfectly capable of extricating from trouble those who stand fast in the truth. In the monumental Summa Theologiae, Thomas states the same position: "Therefore it is not lawful to tell a lie in order to deliver another from any danger whatever. Nevertheless it is lawful to hide the truth prudently, by keeping it back, as Augustine says" (II:110:3).
Can a Lie Ever Be Necessary?
Lying is held to be prohibited by the Eighth Commandment, but that commandment literally condemns only the bearing of false witness (as in a legal proceeding), so lying and other verbal sins are included by extension, through moral reasoning. The importance of speaking the truth is thoroughly rooted in the natural law. For this reason, not only Christians but for most others, at the least, it is intrinsically immoral to speak falsely in a serious matter for an unworthy motive (such as to gain something to which one has no right, or to avoid a punishment that is justly due).
And yet the problem of the "necessary lie" presents itself immediately, a problem recognized and discussed by Christians, non-Christians, and even those of no religion at all. Since the mid-20th century, the same problem has been posed in terms of whether Christians hiding Jews in Nazi Germany could morally lie to those seeking to find and destroy them.
For convenience, consider a man with a house guest whom a group of thugs wants to murder. Because they don’t wish to create an outcry before they’re sure they’ve found their quarry (giving him time to escape, say from a neighboring house), they don’t force their way in to search. Instead, they knock on the door and simply ask whether their intended victim is within. So here is the dilemma: If you answer the door, and you don’t trust the thugs’ intentions, do you have to tell the truth?
Despite the strictures of both Augustine and Aquinas, the vast majority of well-formed Christians would answer this question in the negative. Under these circumstances, they believe it is perfectly permissible to deceive the thugs at the door and they have saints on their side as well. But even these well-formed Christians cannot explain why they may deceive the thugs, or at least they can’t explain it in a way which is universally accepted by sound moral theologians down through the ages, nor in a way that has (yet) been endorsed by the magisterium of the Catholic Church. In other words, most of us believe we can (and indeed should) lie under these circumstances, but we don’t know exactly why.
What Is a Lie?
Note that a solution to this conundrum could come in one of two forms. It may be that: (1) The immorality of lying admits of exceptions such that there is no objective evil, or at least no subjective evil (guilt), in lying to the thugs; or (2) a very careful definition of "lying" will show that speaking falsely to the thugs is not a lie at all.
Many have suggested that the immorality of lying admits of exceptions. These argue, for example, that one is not obligated to tell the truth to an enemy. Such exceptions may be permitted by the principle of double effect: Just as one can morally kill to defend someone’s life, so one can morally lie for a similar reason. The deception (or killing) is a secondary effect of a legitimate action. But with killing there is more at work than double effect. It is not moral to kill anyone whose existence threatens our own lives (consider the case of abortion to save the life of the mother, or cannibalism in a life raft). Rather, the one killed must somehow have the character of an unjust aggressor. Thus we commonly define murder as the taking of an "innocent" life (that is, the right to life has not been forfeited) and we distinguish murder sharply from mere killing. If the same is true of lying, the solution is not so much a matter of exception as of definition.
The difficulty of conceptualizing the perfect definition has caused many over the centuries to insist on the existence of the necessary lie. Such a lie arises from a conflict between justice and veracity when the exercise of both virtues is demanded by the selfsame moral situation. In other words, we are obliged to tell the truth, and we are also obliged to keep secrets, but there are times when the only way to keep a secret is to lie. Both keeping secrets and speaking truthfully are included under all standard expositions of the natural law and the eighth commandment. When our obligation to protect a secret conflicts with our obligation to tell the truth, the result is a necessary lie—necessary not because it helps us to avoid some potential pain but because it is the only way to preserve justice. We may—indeed, we must—deceive the thugs because it is the lesser of two evils.
Our Intentions
"A lie consists in speaking a falsehood with the intention of deceiving" (a citation from Augustine), and "To lie is to speak or act against the truth in order to lead someone into error" (CCC 2482, 2483).
Perhaps the very emphasis on the intention to deceive in this definition suggests another possible line of thought. For, when we speak falsely to our murderous thugs, we may at least question whether our intention is to deceive. Presumably, that intention—if it exists consciously at all—is very secondary. What we primarily intend is to prevent them from doing evil.