Hide custom properties in the UI panel with python
options={'HIDDEN'} prevents operator properties from being auto-drawn. If you define a custom draw() method, nothing will be hidden.

import bpy

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'REGISTER', 'UNDO'}

    prop = bpy.props.BoolProperty(options={'HIDDEN'})

    def execute(self, context):
        return {'FINISHED'}


def register():
    bpy.utils.register_class(SimpleOperator)

def unregister():
    bpy.utils.unregister_class(SimpleOperator)

if __name__ == "__main__":
    register()


To hide global properties, simply don't draw them. You may use conditions to draw properties in certain circumstances:

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout

        if context.object is not None:
            layout.prop(context.object, "name")