How important is it to have a PhD advisor in mind when applying to math PhD programs? I am about to begin my final year as an undergraduate/masters student in mathematics (my school lets us pursue both degrees concurrently), and I will be applying to pure math PhD programs in the fall. I didn't decide to take the PhD route until somewhat recently, so I am trying to learn as much about the process as possible in a short amount of time.

This being said, I know that in many fields, it is expected that you apply to a PhD program after talking to a researcher at that program who you plan to conduct research with if accepted. For example, it is basically impossible to get into an anthropology PhD program studying archaeology if an archaeologist at that program hasn't already guaranteed you a research position in their lab. Is this kind of relationship important for math PhD programs? I have done a lot of online research about applying to PhDs, but I haven't heard much about needing a connection like this prior to applying to math programs.
This is a case where there are very large differences between disciplines and also large differences between countries.  In this answer, I address the situation in mathematics vs. laboratory sciences in the US.    

In mathematics, in the US, most graduate students are supported as teaching assistants rather than as research assistants.  The research assistantships that do exist are usually given to more advanced Ph.D. students.  

In the science disciplines in the US, where most students are supported as RA's it makes little sense to admit a student to a program unless one of the faculty is willing to support that student as an RA.  Since faculty want to get the most out of their graduate students they are very selective and put a lot of effort into training the students in the particular work needed in their lab. As RA's, graduate students are skilled and valued employees that contribute significantly to research.  This is particularly important in disciplines with lots of fieldwork or lab bench work.  

What makes a graduate student attractive as an RA candidate is not always just their academic background.  Particular skill sets (programming and data analysis, or scuba diving, or mountaineering) can make a student attractive for certain RA positions.  For one project that I collaborated on, graduate student RA's collected rock samples at altitudes of 18,000 feet above sea level in Peru.  I've worked with other graduate students that did fieldwork in Antarctica.    

At most universities in the US, first-year graduate students in mathematics are expected to take graduate courses, work as TA's, and start to look for a research advisor.  There's no rush to start on research because the students are supported as TA's and because they typically need one or two years of course work before they can do anything useful in research.  Furthermore, most graduate students in mathematics contribute little or nothing to the advisor's research.  

As a result, graduate admissions committees in math usually work to admit the strongest available students without much thought about who the advisor will be.  Since these students will be working as TA's, there may also be some emphasis on recruiting students with the communication skills and personality to be effective TA's.  

Note that mathematics departments with research groups in different areas of mathematics will often times allocate x TA slots to research group A and y TA slots to research group B.  This helps to spread the students out among the research groups.  It's based on the student having some idea of the general area of research that they want to pursue but not on whether a particular advisor wants the student.