Defines work with (compile time) symbols not identifiers/variables.
program undef_test;
{$define this_symbol}
var
{$ifdef this_symbol}
variable_identifier : longint;
{$undef this_symbol}
{$else}
variable_identifier : double;
{$endif}
begin
{$if declared(variable_identifier)}
writeln(sizeof(variable_identifier));
{$endif}
end.
See
Compiler defines during compilation for more information on defines that are present during compilation. That is besides symbols that you can declare yourself (as per example or at the command-line with option -d)
If you want to check if a Pascal symbol is declared or not the you can use {$if declared(symbol_name)}, see also
Compile time expressions, in particular the chapter
Definitionedit: modified example code to make the example more clear and added if declared example.