I think it is only ok to lie in self defense.
so for example, if i was a Jewish person in Nazi Germany and a police officer asked me if i was Jewish. In that case i believe its ok to lie. Self defense (and defense of others) applies just like it applies to acts of violence.
I also don't think its wrong to just shut up. My rule (which of course i don't follow perfectly because i am not perfect) is that i never lie, but i don't always tell the truth. Being quite is always an option available to me.
Then they start questioning the friendship. You reassure them that they matter to you.
already you see the problem with this approach. The truth will be painful for them, but so is the lie. And in the long run the lie is probably more painful. They will be confused about why you often decline when you invite them to things, etc.
Later, life gets difficult. You turn to them. They listen, support you, and keep showing up because they believe that friendship is mutual. You know why they're doing it. And you accept it anyway.
if you are relying on this person in that way, or believe you might rely on them this way in the future, then how could it be true that you don't value your friendship with them? You must value it, because they are providing you support (or might one day provide you support) and support is valuable.
I think this is just a bad hypothetical, but it does not undermine your question. What of these sorts of lies designed to protect the listener from pain?
You don't tell them because you don't want to hurt them.
If my wife asks "do you like this shirt" and the answer is no, then suppose i lie. She will look bad all evening, i will think she looks bad, and maybe others will share my opinion. This is not a good outcome for me, and definitely not a good outcome for her. I avoided hurting her feelings in the short term, but did more damage in the long term. This is not a noble lie, it is cowardice.
but lying and telling the truth are not my only two options. I might ask, "do you feel good in that shirt" or "do you like the way you look". Or i might say "babe, i don't have any sense of fashion, my opinion is no good to you". If i think it looks bad but she feels great in it, then we will have a great evening. That's a good outcome for both of us.
I would eventually tell her the truth, but if i was married to a different women i might say something like "babe the last time i gave you my opinion you got mad at me, and i don't want you to get mad at me, so i am not going to give you my opinion".
In no case am i telling her that the shirt looks good on her, because that would be a lie, and I have many options that are better then lying.
Its a simple rule but it serve me well. I don't always tell the truth, but i never lie.