Text input field panel add-on blender 2.8
As i mentioned you declared the prop in the wrong way here is an example of how you could do what you want.

just copy and paste the code in the blender script editor and click the register checkbox (im not sure if you have to do that) then click run script, now if you go to the object tab in the properties area at the bottom you should have a Selection query panel, you can type bpy.context.scene.QueryProps.query in the console that should give you the current value for the query property, changing the property in the panel will change the property value to what you typed in.

import bpy

class QueryProps(bpy.types.PropertyGroup):

    query: bpy.props.StringProperty(default="testtest")


class SelectByQuery(bpy.types.Operator):

    bl_idname = "object.select_by_query"
    bl_label = "Selection of object by query"

    def execute(self, context):
        try:
            bpy.data.objects[self.query].select_set(True)
            return {'FINISHED'}
        except:
            print('Could not select object')
            return {'CANCELLED'}


class PanelThree(bpy.types.Panel):
    bl_idname = "VIEW3D_PT_SelectionQuery"
    bl_label = "Selection Query"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'

    def draw(self, context):
        props = bpy.context.scene.QueryProps
        layout = self.layout

        col = layout.column(align=True)
        rowsub = col.row(align=True)

        rowsub.label(text="SELECT *")

        rowsub = col.row(align=True)
        col2 = layout.column()
        rowsub2 = col2.row()
        rowsub2.operator("object.select_by_query", text="Query")
        rowsub.prop(props, "query", text="")


classes = (
    QueryProps,
    SelectByQuery,
    PanelThree
)


def register():

    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)
    # Register QueryProps
    bpy.types.Scene.QueryProps = bpy.props.PointerProperty(type=QueryProps)


def unregister():

    from bpy.utils import unregister_class
    for cls in classes:
        unregister_class(cls)
    # $ delete QueryProps on unregister
    del(bpy.types.Scene.QueryProps)


if __name__ == "__main__":
    register()


also don't forget to mark the question as answered if it answered your question, if you have any question about the answer feel free to write a comment.