If a loan has a pre payment penalty attached would it still be viable to retire it?

It depends. One has to look at what the interest rate is, the amount of the term remaining, the amount of the prepayment penalty and the cost of the source of funds to pay it off. There is no one correct answer, sorry.