Anhydrous HF is a covalent compound and forms strong intramolecular H bonds. It does not give fluoride ions and cannot dissolve AlF3 in it. KF is an ionic compound and contains fluoride ions. It combines with AlF3 to form the soluble complex.
AlF3+3NaF→Na3[AlF6]
B has small size and high electronegativity. It has mauch higher tendency for complex formation than Al. Hence, when BF3 is added to above solution, AlF3 is precipitated.
Na3[AlF6]+3BF3→3NaBF4+AlF3