WordPress setting with select – where is my mistake?

The problem is that in your calls to selected() you haven’t set the 3rd parameter to false. For both selected() and checked() if you don’t do this it will echo the attribute immediately, which won’t work properly if you’re using it inside a concatenated string.

So change:

selected( get_option('myplugin_admin_bar'), 1 )

To:

selected( get_option('myplugin_admin_bar'), 1, false )