Hi,
Welcome to the RStudio community!
I have made the assumptions, based-off the XLM structure, that there is only one ST level in your data, and one BI per TEST. With that in mind, here is my approach:
library(XML)
library(dplyr)
xmlfile = xmlParse("myData.xml")
xml.df.ST <- XML:::xmlAttrsToDataFrame(xmlfile["//ST"])
xml.df.BI <- XML:::xmlAttrsToDataFrame(xmlfile["//BI"])
#Get the TEST data frames in separate lists
xml.df.TEST <- lapply(xmlfile["//BI"], XML:::xmlAttrsToDataFrame)
#Add the IDs of xml.df.BI to each data frame
xml.df.TEST = mapply(function(df, id) {
df$ID = id
return(df)
}, df = xml.df.TEST, id = xml.df.BI$ID, SIMPLIFY = F)
#Now merge them
xml.df.TEST = do.call(rbind, xml.df.TEST)
#Join TEST with BI by ID
result = left_join(xml.df.BI, xml.df.TEST, by = "ID")
#Add all ST data to every row
result = cbind(xml.df.ST, result)
This should scale well for many BI (TEST) datasets in your data and should look similar to the output excel generates. I have been looking for a long time trying to find a known package or function that could do this, as it seems so basic (if Excel can do it...) but no luck hence this 
Hope this helps,
PJ