The reason for this error is that your loading the file without loading in the WordPress system and so wp_query() doesnt exist.
Quick fix is to:
include("../../../wp-load.php");
<– guessing at the location of the wordpress file.
at the top of the php file.