your best option is to keep textfile.txt outside of your webspace.
For example, if your web pages are stored in /var/www/html/ create a dir called /var/www/include/ and store your textfile there.
Your php/whatever files can still include it:
include ("../text/textfile.txt");
include ("/var/www/text/textfile.txt");
but there's no route to it from the web.
If you have to keep it in your webspace, you can stick it in its own directory and use a .htaccess file there with a "deny from all" directive to lock it off from web browsing. This would require your web server to be configured to support this.