So, i haven't heard that anyone today is making this punishable by death, but still...
France has a law that prohibits government workers from wearing religious symbols on their job. This naturally includes the kippa. Quebec was also considering it (the article is from late 2013, i haven't seen anything newer).
According to the Rambam (Yesodei Hatorah 5), during "שעת השמד" - a time of destruction, when the ruler outlaws some Jewish practices, it is a mitzvah to be a martyr and not comply with it. (See also: Self-sacrifice in Jewish law on Wikipedia) I think i remember learning that this applies even to customs.
If the ban was actually so severe that you could be killed (and not just fired or fined), would this qualify for yehareg v'al yaavor - let him be killed and not transgress?