Upon clicking save, how do I stop the node from inserting? Upon saving a new node, I need to check against a function, if its field value is available. If not, I need to prevent the node from saving.

function mymodule_node_insert($node) {
    $uniqueName = $node-&gt;field_name['und'][0['value'];
    if (checkIfAvailable($uniqueName) == FALSE) { die; }
}

function checkIfAvailable($uniqueName) {
    return FALSE;
}
I would probably just use Unique field, as all of the legwork is done.

This module performs additional validation when a node is created or
updated by a user to require that a node's title, author, language,
and CCK fields are unique within a given context.

If you really want it in code though, I'd take a look through the source of this module and see how it adds the extra validation.
I know you said you'd prefer it in code, but I've left this here just in case it benefits anyone with the same question as you :-)