This all depends on what form of lockout it's in.. there are 2 - EKA lockout, where entering the EKA in either the driver's door with the key, or with diagnostics on a BECM of V36 or later will reset that lockout. You can't resync the key fob until that's been resolved as has already been mentioned. You also can't disable the EKA or passive immobiliser whilst the vehicle is in either EKA or alarm lockouts. You can go into the BECM on diagnostics, change them to disabled, and even try to write the settings (Nanocom will even come back and tell you it's done it successfully).
But if you then exit out of the BECM and go back in again, then they will have reverted back to where they were before... the settings for the security side of things at least will only actually be written properly if the BECM is in an unlocked state.
If you have an iffy door latch, then entering the EKA in there won't work - but as mentioned also - you can spoof it with the wires in the door and a couple of switches until the latch is repaired.
If you get KEYCODE LOCKOUT on the dash, you need to wait with the battery connected for this to disappear before attempting to enter the EKA.
If you're unlucky, the BECM has gone into the second lockout, which is the alarm lockout, and it can't be reset by putting the EKA in the door - but sometimes seems resettable with the later models with diagnostics. I know a guy over Peterborough way who has a Nanocom, drop me a PM if you want his details, and I'll drop him a message to make sure he is happy for me to pass them on - he isn't on this forum, so it would probably be his email address.
If it is in complete alarm lockout and doesn't respond to diagnostics via the OBD port to disable it, then I have the tools for reading the logic board and resetting the lockouts with the Direct CPU Access module of the Faultmate. it seems to be the season for it - I've already had 2 in the UK, one from Germany, one from Bulgaria, one from Brunei cross my bench in the last few months - and have one from Ireland that has arrived on Friday. I am happy to quote if you do need to send it off.
The other thought I just had is that if the BECM has been changed at any point in the past, then the EKA you have been given by the dealer might be incorrect. Usually when BECMs are swapped about, records aren't kept as to what VIN etc the donor was from. Reading the VIN number stored in the BECM with diagnostics and comparing it to the one under the windscreen will confirm/deny that theory though.
The short version is - if you can't get the EKA to enter via the door latch, or by mimicking it then you're going to need diagnostics of some description hooked up to it to check it out.
Feel free to PM me if you want any other info or a quote - should you need to send the BECM off.
Hope this helps,
Marty