How can I apply preventDefault() to the click on CodeMirror-hints?

Event delegation is your friend! This way the element doesn’t have to exist when the code runs to have the function bound to it.

jQuery('body').on('click', 'ul.CodeMirror-hints li', function(e) {
    e.preventDefault();
});

replace click with mousedown if you need to