The believer should not make friends with anyone but another believer, and not mix with anyone but believers, unless he is mixing with others in order to enjoin what is good and forbid what is evil, or to call people to Allah, or for some worldly purpose such as buying and selling, working, and so on.
That is because the Prophet (blessings and peace of Allah be upon him) said: “Do not keep company with anyone but a believer and do not let anyone eat your food but one who is pious.”
Narrated by al-Tirmidhi (2395); classed as hasan by al-Albaani in Saheeh al-Tirmidhi.
And he (blessings and peace of Allah be upon him) said: “A man will follow the way of his close friend, so let one of you look at who he takes as a close friend.”
Narrated by Abu Dawood, 4833; classed as hasan by al-Albaani in Saheeh Abi Dawood and elsewhere.
It says in ‘Awn al-Ma‘bood:
i.e., think long and hard about the one whom you take as a close friend. If his religious commitment and character are good, then take him as a close friend, otherwise avoid him because one will be influenced by the attitude and behaviour of one’s friends. End quote.
If a person mixes with non-believers because of work, ties of kinship, or unavoidable need, it is not permissible to sit with them when they are committing evil actions.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
It is not permissible for anyone to attend by choice gatherings in which evils are committed except in cases of necessity, as it says in the hadeeth: “Whoever believes in Allah and the Last Day, let him not sit at a table where wine is being drunk.” Some people who had drunk wine were brought to ‘Umar ibn ‘Abd al-‘Azeez and he ordered that they be flogged. It was said to him: Among them is one who was fasting. He said: Start with him; have you not heard that Allah says (interpretation of the meaning): “And it has already been revealed to you in the Book (this Qur'ân) that when you hear the Verses of Allâh being denied and mocked at, then sit not with them, until they engage in a talk other than that; (but if you stayed with them) certainly in that case you would be like them” [al-Nisa’ 4:140]?
‘Umar ibn ‘Abd al-‘Azeez (may Allah be pleased with him) explained that Allah regards the one who is present when evil is committed as being like the one who does it. Hence the scholars said: If a person is invited to a wedding feast in which there are evils such as alcohol and musical instruments, it is not permissible for him to attend it. That is because Allah, may He be exalted, has instructed us to denounce evil as much as possible. If a person attends willingly and does not denounce it, then he has disobeyed Allah and His Messenger by not doing what he was commanded to do of hating the evil and speaking against it. If that is the case, the one who willingly attended the gathering where alcohol was drunk with no necessary reason to do so, and did not denounce the evil as Allah enjoined, is a partner with the evildoers in the evil actions and is regarded as one of them. End quote.
Majmoo‘ al-Fataawa, 28/221-222
Based on that, your saying to the one who offers you alcohol “Thank you” (as in “No, thank you”) is contrary to hating and denouncing the evil, because this person will think that he has been kind to you and he will not understand that he has done something wrong by drinking alcohol and offering it to you.
If this is a Muslim, then you have to denounce his drinking alcohol and advise him to give it up. If he is not Muslim, then the least you can do is explain to him that you do not drink alcohol because your religion forbids it.
For more information please see the answer to question no. 96662
And Allah knows best.