Can’t find variable is_single in my jQuery plugin

The easiest way in WP to write php into JS is using wp_footer

function sse246626_js() {
 if(is_single()) {
  echo '<script type="text/javascript">';
   echo 'jQuery(document).ready(function($) {';
    echo '$("#mydiv").hide();';
   echo '});';
  echo '</script>';
 }
}
add_action('wp_footer', 'sse246626_js');

This way gives you access to the WP functions as you need, there are probably better ways of doing it if you have lots of JS (php file as a JS file) but it gets slightly complicated as you need to load the WP functions to be used in the file.