Query all post types but limit to parents

In your functions.php you can create a function that will hook into the pre_get_posts hook. Something like (just an example):

function alter_query($query){
  $query->set('post_parent', 0);
}
add_action( 'pre_get_posts', 'alter_query' );

There you can alter the main query. That way while(have_posts()) : the_post(); will still just normally work. (You should check if you are altering the right query and such. Otherwise the post_parent will be applied to all query’s by wordpress. You don’t want that).

The BIG advantage is, that if you alter the main query, you only have to do that. WordPress will still select the appriopiate template and such. If you also want to alter the template loaded, you can use the template_redirect hook.