The straight answer is: yes; at every available opportunity. And sure enough, history shows that governments negotiate with terrorists more often than not. At the time that Margaret Thatcher was insisting "we do not negotiate with terrorists", that is precisely what she was doing. This should hardly have come as a surprise, as British governments have episodically negotiated with the IRA for close on a century. Thatcher's language was a deliberate echo of similar sentiments expressed by the South African government in the 1980s. Again, it was subsequently revealed that they had been negotiating with the ANC for years. In retrospect, who could be appalled at the idea of a nice friendly chat with Nelson Mandela or Walter Sisulu?
Despite this, the world is never short of politicians demanding a principled refusal to negotiate with terrorists. Some even go so far as to rationalise it in instrumental terms. According to Republican Senator Ted Cruz: "The reason why the U.S. has had the policy for decades of not negotiating with terrorists is because once you start doing it, every other terrorist has an incentive to capture more soldiers". Let me see if I've got this right ... the prospect of negotiation makes it less likely that the terrorists will simply kill your soldiers out of hand, because they're worth more alive than dead. If I were a serving soldier, I'd be broadly in favour of that. Surely the real "terror" is facing an opponent who literally cannot be negotiated with. Would you rather face the Taliban or the critter in Alien?
Cruz seems unaware that the US government has routinely negotiated with terrorists in the past. His comments appear particularly dim at a time when the Nigerian government is being publicly encouraged to negotiate with Boko Haram. This doesn't just reflect the greater vulnerability (or media-friendliness) of the hostages, but a pragmatic assumption that this is the only viable option given the weakness and corruption of the Nigerian government and military. This patronisation of the lesser by the greater, and the affront of the latter when they are recipients of similar advice, is par for the course. Intransigence is a sign of strength in ourselves, and a lack of reason in others.
The "no negotiations" stance can be seen as a form of military discipline. The message is: fight to the last, because if you are taken hostage, we're not going to cut a deal for you. But in practice, this is a hollow threat. In a democracy there is an implicit contract (which may even be explicit) that troops will not to be treated as disposable commodities. Even in non-democracies, esprit de corps fundamentally rests on the idea of reciprocal loyalty: no one gets left behind. To listen to some of the American commentary on Bowe Bergdahl's unworthiness, you'd think the Republican Party wanted to institute political commisars who would shoot deserters on sight.
The issue of the soldier's personal worth is irrelevant (and so is nit-picking about whether the Taliban count as terrorists or military combatants, and whether Bergdahl was a POW or hostage). Whether he deserted or not, he remains a US citizen. Equally, the simplistic accounting of the exchange - five for one - is meaningless. As Jim Wright asked: "If our people aren’t worth four or five terrorists sitting in a Gitmo prison cell, then you tell me why we’ve spent the last twelve years in two wars, why we traded the lives of six thousand servicemen and why we killed hundreds of thousands [of] Iraqis and Afghans to avenge three thousand Americans". There is no going rate for a hostage, or for a POW in an asymmetric conflict.
The interpretation that the Taliban got the better end of the deal because of the numerical difference is stupid. If anything, the bigger the number you secure, the weaker you are. This is why Israel was happy to release over a thousand Palestinians in return for a single soldier in 2011. What matters in a prisoner exchange is not the quantum but the percentage of stock: the Taliban have no more US military prisoners, while Guantánamo continues to house scores of Talibani. Pragmatically, the swap for Bowe Bergdahl now looks obvious and timely given that Obama recently confirmed a date for the US exit from Afghanistan (and implicitly a winding-down if not complete closure of the Guantánamo facility).
There are some in government who advocate a realpolitik attitude, in which negotiation is acceptable in principle but hedged by various qualifications about the "rationality", sincerity and competence of the terrorists. This is self-serving nonsense in which the ideal terrorist for negotiating with looks remarkably like a vanquished enemy suing for peace. Governments will almost always be negotiating from a position of relative strength (if the terrorists are the stronger, then the government may not have a choice in whether to negotiate or not). As the stronger party, government can almost always walk away from the table - there is rarely an offer you cannot refuse - so there is little to lose in sitting down. Even if the potential for gain is initially small, simply establishing a relationship is a prudent investment for the future.
The only downside consideration is the possibility of bad publicity - i.e. a charge of hypocrisy or weakness from your own side - should the negotiations become public too early. In other words, the "never negotiate with terrorists" principle is essentially a media construct. The paradox is that in a democracy a government would be irresponsible and foolish not to negotiate at every opportunity, yet a free press militates against making negotiation the default policy.