Drupal: user directory shows blocked users
From your query and the default Block User account user settings option available to the Site Administrator per User:

Simply add into your SQL query WHERE clause the following:

and users.status &lt;&gt; 0

and this will change your user list to NOT include blocked users.