TLDR: Phonetic scripts won't work because of how the Chinese languages are structured. So it never really came up before Europeans arrived.
Language Issues:
There are several ways to answer this question; before I get into the history, it is important to ask: Is it possible to represent Chinese in a phonetic script?
According to my first Chinese language book, Beginner's Chinese by Yong Ho, Putonghua [i.e., Mandarin] has 21 consonants and 6 vowels, and most syllables are organized in a CV (Consonant-Vowel) format. Some examples of CV in English: be, he, me. Chinese has a handful of standalone V words, but they usually start with the glottal stop consonant like the one in uh-oh; there are also many CVC words, but the final consonant must be a nasal n or ng; finally, there are some VC words without an initial consonant. And that's it. English, on the other hand, has many, many different syllables: VC (up), CVC (big), CCVC (dread), CVCC (mask), CCV, CCCV, VCC, VCCC, CCVCC (brand), CVCCC, CCCvCC, CVCCCC (texts), etc.[1]
So with only 21 constants and 6 vowels, there are only about 1000 possible sound combinations, and about 400 get used. Add in the 4 tones, there are 1600 sounds combinations. In English, there are more than 158,000.[1]
The limited number of syllables means that there are a ton of words that would have an identical spelling. These are called homophones. While English has a bunch of homophones Chinese has so many that it would be impractical to use a phonetic script.
History:
However, this didn't stop people from trying. Chapter 2 of China's Soviet Dream (this book is awesome) speaks in great detail about language reform in the first decade of the PRC. China wanted to modernize, and many felt that with a character-based written language, literacy would not be possible. They looked, of course, for historical examples where Chinese people had achieved widespread literacy. There was only one, and it occurred in the Soviet Union.
Apparently, in the 1920s, there were a bunch of migrant workers from Shandong living in Eastern Siberia. The Soviet Union invented a romanization scheme based on their Jiaoliao dialect called Latinxua Sin Wenz. It worked — these migrant workers learned to read the newspaper, allowing them to read SU propaganda.
For a variety of reasons, these migrant workers returned to China in the early 1930s, and they brought Latinxua Sin Wenz with them. As explained in Part IV of John DeFrancis's Chinese Language, the script was adopted by many Communists in their areas of control and adapted to dialects all over China, including Hakka and Shanghainese. Lu Xun and Mao argued in its favor, and the Communists gave it equal legal status to characters in 1941. World War II and China's Civil War interrupted literacy efforts. The system required accepting a lot of ambiguity because of its lack of tones, but that wasn't insurmountable to native speakers. Instead, the probable reason that the PRC abandoned it sometime in late 1949 or early 1950 was the criticism that its advocates were "a cultural movement of traitors". Having taken over the country, the Communists stopped advocating a policy that would permit greater balkanization. The Party line became to simplify the characters instead and to develop a new latinized alphabet with tones to teach pronunciation.
Latinxua Sin Wenz grew in to Hanyu Pinyin, which is in common usage throughout China today. However, it is rarely used for general reading; it is more of an instructive tool to facilitate the dominance of the Beijing Dialect, with the explicit goal of limiting China's linguistic diversity and centering power around Beijing and this the CCP. Hanyu Pinyin makes it easier for me to learn Chinese too!
However, you specifically asked about attempts to use a phonetic script prior to 1911. To my knowledge, the first attempts were intended primarily to help Christian missionaries learn Chinese, with one scheme by Matteo Ricci dating to 1583. However, these schemes were developed by non-Chinese for a variety of reasons.
The first phonetic script that I am aware of, developed by a Chinese person, was in 1892. This scheme, however, was merely an extension of the missionaries' attempts and was definitely part of a modernization/literacy scheme.
[1] Ho, Yong. Beginner's Chinese. Hippocrene Books, 2005.
[2] Li, Yan. China's Soviet Dream: Propaganda, Culture, and Popular Imagination. Routledge, 2017.
[3] DeFrancis, John. The Chinese Language: Fact and Fantasy. Univ. of Hawaii Press, 1984.