how would I include some html in the header section of a wordpress plugin? I get an error

The answer…

add_action('init', 'text_on_top');

function text_on_top(){
    ?>
        <div id="bar">hello there</div>
    <?
}

Never output anything outside of a function, use a suitable action/filter to do so!