Before I looked at this I was hoping the Advanced Search was a UI action. Then you could hide it completely or add an action evaluator to hide it based on whatever criteria you wanted to. Unfortunately it isn't. The place that link is generated is in org/alfresco/web/ui/repo/component/UISimpleSearch.java. If you want to remove the link or conditionally hide it or whatever, you'll have to override that component with your own that behaves like you want it to.
I don't have the 2.1 source locally anymore. You'll have to grep for it yourself. Start with the search method in org.alfresco.web.bean.BrowseBean and drill down from there.
The general approach for stuff like this is to start with the "Advanced Search" label and find it in the messages. Then, once you have the message label ID (advanced_search), you can find the JSP the component resides on (jsp/parts/titlebar.jsp contains "<r:simpleSearch id="search" actionListener="#{BrowseBean.search}" />"). Once you have that, you can grep the faces config for the class that implements the component ("BrowseBean" is in WEB-INF/faces-config-beans.xml). From there you grab the class (org.alfresco.web.bean.BrowseBean) and figure out what it's doing.