Some details would help.
What sequence of commands are you executing? Which window type are you using?
In general, interactive clients like SQL*Plus and PL/SQL Developer tend to run various steps automatically after returning from a database call. In this case it appears PL/SQL Developer is calling dbms_transaction.local_transaction_id to determine whether to light up the Commit/Rollback toolbar buttons. I'm guessing what you'd like to see is a setting to disable this at window level (perhaps a SET command for Command windows), but I am pretty sure there is no such option currently.
What I generally do is put both the query and the call to dbms_xplan inside a single PL/SQL block.
begin
execute immediate 'alter session set statistics_level = ALL';
for test in (
-- Your test query here:
select * from some_table t
where t.some_col = 123
)
loop
null;
end loop;
for x in (
select p.plan_table_output
from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST +OUTLINE +NOTE')) p
)
loop
dbms_output.put_line(x.plan_table_output);
end loop;
rollback;
end;
One advantage of this is that you can use native PL/SQL variables such as dates, which aren't supported by SQL*Plus.