This MercurialControllingHookBase descendant implements the code necessary to handle the "prelistkeys" hook: This is run before listing pushkeys (like bookmarks) in the repository.
As with all controlling hooks (descendants of MercurialControllingHookBase), you can prevent the command from continuing, or let it continue, by calling MercurialControllingHookBase.TerminateHookAndCancelCommand(int) or MercurialControllingHookBase.TerminateHookAndProceed respectively.