I know not the point of your post, but that error message could be changed using Language Overrides.
I think it tends to be the registrar module that determines when the lock option is shown (or even if the feature is supported).
I assume you mean the opposite, e.g to disable the display if the TLD is in an excluded list (or not in an included list) - though I think an excluded list would be shorter.
that sounds like a ClientAreaPageDomainDetails hook that takes the current domain, splits it into two to get the sld/tld separately and then checks that TLD against a list... if a match, then it falsifies $managementoptions.locking - that should prevent the normal link being shown to the user... additionally, you might need another hook to remove the sidebar option.