The verse you're asking about was revealed to Prophet Muhammad when Ammar Yasir bad things about Prophet Muhammad when he didn't really mean it.
الصّادق (علیه السلام)- عَنْ عَبْدِاللَّهِبْنِعَجْلَانَ عَنْ
أَبِیعَبْدِاللَّهِ (علیه السلام) قَالَ سَأَلْتُهُ فَقُلْتُ لَهُ
إِنَّ الضَّحَّاکَ قَدْ ظَهَرَ بِالْکُوفَهًِْ وَ یُوشِکُ أَنْ نُدْعَی
إِلَی الْبَرَاءَهًِْ مِنْ عَلِیٍّ (علیه السلام) فَکَیْفَ نَصْنَعُ
قَالَ فَابْرَأْ مِنْهُ قَالَ قُلْتُ لَهُ أَیُّ شَیْءٍ أَحَبُّ إِلَیْکَ
قَالَ أَنْ یَمْضُوا عَلَی مَا مَضَی عَلَیْهِ عَمَّارُ بْنُ یَاسِرٍ
أُخِذَ بِمَکَّهًَْ فَقَالُوا لَهُ ابْرَأْ مِنْ رَسُولِ اللَّهِ (صلی
الله علیه و آله) فَبَرِئَ مِنْهُ فَأَنْزَلَ اللَّهُ عُذْرَهُ إِلَّا
مَنْ أُکْرِهَ وَ قَلْبُهُ مُطْمَئِنٌّ بِالْإِیمانِ.
I told Imam Sadiq: Zahhak ahas entered Kufa and is near our city. He's
forcing us to show hatred towards Ali. Imam Sadiq said: Do that! I
asked: What is more liked by you? Imam Sadiq said: To do like what
Ammar ibn Yasir did when he was arrested in Mecca was told you
need to reject Prophet Muhammad(PBUH) and he did such. Allah revealed
an excuse for him except under compulsion, his heart remaining firm in Faith ( إِلَّا مَنْ أُکْرِهَ وَ قَلْبُهُ مُطْمَئِنٌّ بِالْإِیمانِ)
From: تفسیر اهل بیت علیهم السلام ج۷، ص۷۴۴ بحارالأنوار، ج۷۲، ص۴۰۸/ العیاشی، ج۲، ص۲۷۲/ نورالثقلین/ البرهان
More on this:
Ammar was tortured "until he did not know what he was saying," as was
his friend Suhayb; in that state, he eventually maligned Muhammad and
spoke well of the pagan gods. Afterwards he went to Muhammad and
confessed his recantation. Muhammad asked, "How do you find your
heart?" When Ammar replied that he was still a Muslim in his heart,
Muhammad said all was well. A verse of the Qur'an, "someone forced to
do it whose heart remains at rest in its faith" (16:106), refers to
Ammar.
With that verse in mind the only interpretation of this hadith is: It's only permitted to pretend to disbelieve i.e. to say the words. It is not permitted to actually disbelieve. At all times we're instructed to perform our 5 daily prayers. Even if there's a gun facing us, then we can avoid moving our lips, but perform the prayer in spirit. Aside from that martrydom isn't recommended, based on historical evidence and hadith.
The main difference between Taqiyya and lying is that with Taqiyya is that with lying you’re oppressing the other who expects you to speak the truth. However when an oppressor intends to kill you, then he’s is undeserving. Additionally Taqiyya is different from hypocrisy. Hypocrisy is when you’re heart is not with Allah but you only follow the prophet or believers solely for worldly gains e.g. you see the Muslims winning the wars, yet while you truly like the idols you follow the Muslims and pray like them so you can benefit from their success.