Pegmatite–related deposits represent one of the most significant types of mineral deposits housing rare–metal elements such as Li, Be, Nb, Ta, Rb, Cs, and Sn. Although extensively studied for almost two centuries, the mechanism controlling the rare–metal mineralization in pegmatites remains controversial. In addition to the enrichment of rare–metal elements in the source region, differentiation processes (e.g., fractional crystallization and liquid immiscibility) after emplacement may have also contributed to the concentration and mineralization of rare–metal elements. However, compared to fractional crystallization, the role of liquid immiscibility in pegmatite mineralization has received limited attention. In this study, the element and boron (B) isotopic compositions of tourmalines from different textural zones (Zones I–VI) of the rare–metal–mineralized Koktokay No. 3 pegmatite, Altai, NW China, as well as from the altered country rock and the border zone, were analyzed to evaluate the role of liquid immiscibility in the generation of Li–mineralized pegmatites. Tourmalines display a variety of compositions, ranging from schorl and elbaite in the outer zones to elbaite in the inner zones of the Koktokay No. 3 pegmatite. Tourmalines from Zones I–III exhibit no obvious internal textures, whereas some tourmalines from Zones IV–VI have replacement textures or abrupt zonations. The distinction is attributed to the absence and presence of exsolving fluids during their formation, respectively. Tourmalines in Zones I–III and VII–VIII display less variable δ11B values (–15.07 ‰ to –12.21 ‰ and –14.16 ‰ to –13.10 ‰, respectively), reflecting a negligible B isotope fractionation produced by fractional crystallization during the pegmatite evolution. By contrast, tourmalines in Zones IV–VII exhibit more significant variations in δ11B values (–14.83 ‰ to –8.09 ‰) compared to those in Zones I–III and VII–VIII. The high δ11B tourmalines in Zones IV–VII were most likely crystallized from the fluids exsolving from the highly evolved pegmatite–forming magma. Their occurrence indicates the fluid exsolution occurring between zones IV and V, where Li mineralization began in the Koktokay No. 3 pegmatite. The mineralization of rare–metal elements is closely linked to the evolution of magma into a coexisting magma–fluid system. In addition, Li–mineralized pegmatites are characterized by tourmalines with Fe3+Al-1 substitution and higher Zn, Li, Li/Sr, and V/Sc than barren pegmatites. These differences are believed to be due to the higher fO2 and greater extent of magmatic differentiation in Li–mineralized pegmatites compared to the barren ones. These findings provide new insights into using the geochemical compositions of tourmalines as a guide for exploring Li–mineralized pegmatites.