How to prevent users from being registered when their username contains a space?
@Jeroen,
Then I would suggest to do just one custom form alter to the user registration form and add a validation function that will validate each case for you.

/**
 * Implements hook_form_FORM_ID_alter().
 */
// Alter the registration form
function CUSTOM_MODULE_form_user_register_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // Add your own function to the array of validation callbacks
  $form['#validate'][] = 'CUSTOM_MODULE_user_validation';
}

/**
 * Custom function to validate the user creations.
 */
function CUSTOM_MODULE_user_validation(&amp;$form, &amp;$form_state) {
  $name = $form_state['values']['name'];
  if (preg_match('/\s/',$name)) {
     form_set_error('name', t('Name should not contain white spaces.'));
  }
}


Its easier to use and doesn't invoke rules API every time. I also think this is much effective for performance.