Article 42(2) TEU says:
2. The common security and defence policy shall include the progressive framing of a common Union defence policy. This will lead to a common defence, when the European Council, acting unanimously, so decides. It shall in that case recommend to the Member States the adoption of such a decision in accordance with their respective constitutional requirements.
So the UK has control over any possible ‘common defence’, by means of its veto. And there’s more: the ‘constitutional requirements’ that would apply in the UK are not only parliamentary approval, but also a referendum, according to the European Union Act 2011.
Source: EU Law Analysis: EU Referendum Briefing 1: Can the UK control the EU’s future if it stays a member?