How to use the “domain_exists()” function

domain_exists() is something you probably won´t call by yourself.

It is used in the registration/creation process of new sites in a Multisite installation. There it´s used to check if a specific blog URL is already in use:

if ( domain_exists($mydomain, $path, $current_site->id) )
    $errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );

(From /wp-includes/ms-functions.php, line 612-613)

The “normal” Codex also has a page about it: mu_exists()

You can see that it was introduced with the Multisite functionality in WP 3.5, it´s defined in lines 1256-1259 of /wp-includes/ms-functions.php

function domain_exists($domain, $path, $site_id = 1) {
    global $wpdb;
    $path = trailingslashit( $path );
    $result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
}

All in all you most probably don´t want to call it yourself. If you want to check for an existent site or something like that, there are more comfortable functions like wp_get_blogs().